{"record":{"id":"b680283921b9a63f","repo":"deepseek-ai/deepseek-harness","slug":"tool-arguments-must-be-lossless-json-call-the-too","errorCode":null,"errorMessage":"tool arguments must be lossless JSON (call the tool with an arguments object, e.g. `{}`)","messagePattern":"tool arguments must be lossless JSON \\(call the tool with an arguments object, e\\.g\\. `(.+?)`\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/tools/src/code-mode.ts","lineNumber":161,"sourceCode":"    super(message, 'CODE_RUN_FAILED')\n    this.name = 'CodeRunFailedError'\n  }\n}\n\n/**\n * Snapshot one binding call's argument as lossless JSON, then snapshot that\n * detached value again so dispatch and logging stay independent without\n * reintroducing structured-clone's platform-specific nesting limit.\n */\nfunction jsonNormalizeArgs(value: unknown): { dispatched: unknown; logged: unknown } {\n  let snapshot: JsonValue | undefined\n  try {\n    snapshot = snapshotJsonValue(value) as JsonValue | undefined\n  } catch (error: unknown) {\n    throw new Error(`tool arguments must be lossless JSON: ${error instanceof Error ? error.message : String(error)}`)\n  }\n  if (snapshot === undefined) {\n    throw new Error('tool arguments must be lossless JSON (call the tool with an arguments object, e.g. `{}`)')\n  }\n  const logged = snapshotJsonValue(snapshot)\n  /* v8 ignore next -- snapshot is already a detached lossless JSON value. */\n  if (logged === undefined) {\n    throw new Error('tool arguments could not be detached for durable logging')\n  }\n  return { dispatched: snapshot, logged }\n}\n\n/** Two-space JSON presentation, matching the existing shallow `run_code` text contract. */\nconst JSON_INDENT = '  '\n\n/**\n * ECMAScript caps `JSON.stringify`'s `space` string at ten characters. The\n * renderer also caps TOTAL indentation there, compacting deeper subtrees, so\n * formatted output remains linear in the canonical JSON size.\n */\nconst MAX_JSON_INDENT_CHARS = 10","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/tools/src/code-mode.ts#L143-L179","documentation":"Error \"tool arguments must be lossless JSON (call the tool with an arguments object, e.g. `{}`)\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/tools/src/code-mode.ts:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}