deepseek-ai/deepseek-harness · error · TypeError
tool execution arguments must be losslessly…
Error message
tool execution arguments must be losslessly JSON-serializable
What it means
Durable-boundary rejection during tool-call argument materialization: the incoming tool arguments (possibly through an arguments getter) do not survive lossless JSON serialization. Arguments must be frozen to an exact JSON snapshot before dispatch, so non-representable values are rejected before the tool body runs.
Solutions
- Send arguments as plain JSON from the model/client side
- Remove getters or proxy layers that inject non-JSON values into arguments
- Validate and normalize external argument payloads at the wire boundary
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/core/tools/src/index.ts:1414 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/00f32c54a8ea335e.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/tools/src/index.ts:1414
},
}
// Capture the finalizer BEFORE argument materialization: the
// `finalizeContent` contract snapshots the callback when the call starts,
// and an arguments getter can replace or clear the registered callback
// during `snapshotJsonValue`. The collapse only decides whether the
// CAPTURED callback is retained: the pre-dispatch abort path keeps it
// (the cancellation contract routes aborted results through it — a getter
// that aborts mid-materialization before an invalid-args failure lands in
// the same retained path), while the `UNKNOWN_TOOL` denial and the
// invalid-args failure of a NON-ABORTED collapsed call drop it (the call
// could never execute).
const capturedFinalizer = visible?.finalizeContent?.bind(visible)
const finalizerFor = (): ToolDefinition['finalizeContent'] | undefined =>
collapsed && !signal.aborted ? undefined : capturedFinalizer
try {
const detached = snapshotJsonValue(exec.arguments)
if (detached === undefined) {
throw new TypeError('tool execution arguments must be losslessly JSON-serializable')
}
const execution: MutableToolRunContext = { ...base, arguments: deepFreeze(detached) }
this.deferredContexts.set(execution, deferredContexts)
this.contentFinalizers.set(execution, finalizerFor())
this.cancellationStates.set(execution, {
callerSignal: signal,
bodyInvoked: false,
})
if (collapsed) {
// The collapse denies the call before the policy pipeline, but a
// pre-dispatch abort still keeps the established cancellation
// contract: `prepare`'s caller-cancellation check is skipped for
// final-results, so honor the abort here instead of surfacing
// `UNKNOWN_TOOL` on an already-cancelled call.
if (signal.aborted) {
return { kind: 'final-result', exec: execution, result: toolAbortedBeforeDispatchResult() }
}
// The name IS visible here, so the denial carries the route the modelView on GitHub (pinned to b150a551b8)