claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Invalid JSON Request: Malformed Low Surrogate in API Payload

Open KentaSUGAI opened this issue 5 months ago • 1 comments

Bug Description ⎿ 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 116673 (char 116672)"}}

Environment Info

  • Platform: macos
  • Terminal: Apple_Terminal
  • Version: 1.0.22
  • Feedback ID: c5182fec-4bd6-4c0d-a50e-1f873c9daeab

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 zZ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:659:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:8871\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:17199)\n    at tJ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:8017)\n    at XS (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:7098)\n    at O6 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:11210)","timestamp":"2025-06-13T22:32:17.584Z"},{"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 116673 (char 116672)\"}}\n    at g6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1329:12578)\n    at Mw.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1344:2082)\n    at Mw.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1344:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async FE2.C11.showErrors (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:22008)\n    at async C11 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:12203)\n    at async FE2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:21854)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:17103\n    at async Nt1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:5151)\n    at async Yu (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:17073)","timestamp":"2025-06-13T22:32:47.255Z"},{"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 116673 (char 116672)\"}}\n    at g6.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1329:12578)\n    at Mw.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1344:2082)\n    at Mw.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1344:5257)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async FE2.C11.showErrors (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:22008)\n    at async C11 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:12203)\n    at async FE2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:21854)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:17103\n    at async Nt1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:5151)\n    at async Yu (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1700:17073)","timestamp":"2025-06-13T22:34:58.761Z"}]

KentaSUGAI avatar Jun 13 '25 22:06 KentaSUGAI

Same issue here. Stopped while making changes. Only a new claude instance will work, so the scripts are broken now.

SM-Fahim avatar Jun 17 '25 20:06 SM-Fahim

Thank you. The issue is resolved.

KentaSUGAI avatar Jul 08 '25 05:07 KentaSUGAI

nop

siri666666 avatar Jul 13 '25 06:07 siri666666

The best way to handle this is to first run a /export that will export the current conversation so you don't lose any context. Then /clear to reset the context. Then prompt "@[name-of-context-file].txt continue from here", Example: "@2025-07-31-this-session-is-being-continued-from-a-previous-co.txt continue from here". After that Claude will have the same context as it did before the issue. Then continue as normal.

brianmcaudill avatar Jul 31 '25 14:07 brianmcaudill

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Aug 07 '25 14:08 github-actions[bot]