Invalid JSON Parsing Error Causing Unexpected API Request Failure

Resolved 💬 1 comment Opened Jun 21, 2025 by prodepollo Closed Jul 10, 2025

Bug Description
Claude code stopped working and outputting the error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"The request body is not valid JSON: no low surrogate in string: line 1 column 172783 (char 172782)"}}
This is now quite annoying since it is happening multiple times and I need to exit and restart the session causing huge disruption to the workflow as there is no way to save gracefully the status.

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.31
  • Feedback ID: cdc19c01-5943-409a-9493-56afbe1ec222

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at NZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:700:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:9014\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:17199)\n    at GX (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:8160)\n    at fS (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:7241)\n    at R9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:622:11408)","timestamp":"2025-06-21T11:10:38.806Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: prisma\n    at aD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1472:1184)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1472:912\n    at Array.map (<anonymous>)\n    at kK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1472:903)\n    at DU2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1865:7514)\n    at xE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n    at mT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n    at gT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n    at qq (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n    at eE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)","timestamp":"2025-06-21T11:58:14.370Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: prisma\n    at aD (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1472:1184)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1472:912\n    at Array.map (<anonymous>)\n    at kK (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1472:903)\n    at DU2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1865:7514)\n    at xE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:19803)\n    at mT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:42555)\n    at gT (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38104)\n    at qq (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:38032)\n    at eE (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:37886)","timestamp":"2025-06-21T12:01:32.624Z"},{"error":"Error: String not found in file. Failed to apply edit.\n    at gO (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1720:546)\n    at Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1947:2277)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async aY5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1837:12597)\n    at async DH1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1837:10753)\n    at async iY5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1837:9777)\n    at async cY5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1837:9406)\n    at async uO (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1837:8360)\n    at async uO (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1837:9261)\n    at async wB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2468:2575)","timestamp":"2025-06-21T12:10:19.302Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"The request body is not valid JSON: no low surrogate in string: line 1 column 172783 (char 172782)\"

Note: Error logs were truncated.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗