[BUG] Session broken -> 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 410559 (char 410558)"}}
Environment
-
Platform (select one):
- [x] Anthropic API
-
Claude CLI version: 1.0.16
-
Operating System: Ubuntu 22.04 (wsl)
-
Terminal: wsl
Bug Description
Claude was making edits to files (auto accept edits on) and then stopped after an edit with 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 410559 (char 410558)"}}
The session completely broke and its not possible to recover .. prompting claude to continue just produces the same error (with different column and char numbers). Downgrading to lower versions and resuming the session produces the same error (but a new session works fine)
Steps to Reproduce
Any message in that session will produce the error
Expected Behavior
Claude continues
Actual Behavior
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 410559 (char 410558)"}}
Also experiencing this
Possibly related https://github.com/anthropics/claude-code/issues/1701
it happened again in the next session. Seems to happen when editing large files. At least it happened just now in the new session when editing the same large file (a markdown file with ~1700 lines).
edit:
i downgraded to 1.0.9 and claude was able to do multiple edits to the same file with auto-accept edits on
same problem
Just experienced it when editing a file
Happens to me as well. Latest version - 1.0.55. In my case it wan't a large file.
It helped me to press Esc twice and select one of the previous queries.
Hitting this issue about once every 24 hours on my Macbook.
Have you tried running "/clear" or opening a new terminal (killing the old claude session)? I think it's an internal error where it doesn't manage some part of the memory well. It doesn't compact, it just dies with the MCP plugin. I was using playwright and it started happening.
Same here issue here.
Same issue facing here as well
Just hit this as well. Tried restarting my terminal session, and logging out and back in.
Clearing the session is not really an acceptable fix if you're in the middle of something, all of the previous context dissappears which is very problematic in the middle of claude applying iterative fixes
Still occuring. WSL 2, debian, CC v2.0.1 Seems to happen after calling playwright or serena mcp for me. After which my session is hosed and I can't send any more messages.
It happens again in Claude Code v2.0.10. I'm using the latest version of Claude Code extension in VSCode.
Still happening (MacOS 15.6.1, Claude Code 2.0.14) :-(
Context: developing a tool (Typescript) to sanitise text containing unicode-based pseudo-formatting => when the context contains certain unicode characters it obviously breaks the API.
Desired behaviour: Claude's API is able to process the full Unicode character range
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.