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

[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)"}}

Open dayowe opened this issue 7 months ago • 16 comments

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)"}}

dayowe avatar Jun 06 '25 12:06 dayowe

Also experiencing this

Possibly related https://github.com/anthropics/claude-code/issues/1701

adriangalilea avatar Jun 06 '25 12:06 adriangalilea

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

dayowe avatar Jun 06 '25 12:06 dayowe

same problem

patie avatar Jul 05 '25 11:07 patie

Just experienced it when editing a file

ngenohkevin avatar Jul 05 '25 17:07 ngenohkevin

Happens to me as well. Latest version - 1.0.55. In my case it wan't a large file.

davidfirst avatar Jul 18 '25 13:07 davidfirst

It helped me to press Esc twice and select one of the previous queries.

pozitronik avatar Aug 14 '25 14:08 pozitronik

Hitting this issue about once every 24 hours on my Macbook.

metaColin avatar Aug 28 '25 05:08 metaColin

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.

ldmtwo avatar Sep 04 '25 14:09 ldmtwo

Same here issue here.

pleberre avatar Sep 05 '25 06:09 pleberre

Same issue facing here as well

vashukarn avatar Sep 05 '25 07:09 vashukarn

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

awilson9 avatar Sep 13 '25 12:09 awilson9

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.

Image

pinkwerks avatar Oct 01 '25 16:10 pinkwerks

It happens again in Claude Code v2.0.10. I'm using the latest version of Claude Code extension in VSCode.

dinhanhthi avatar Oct 10 '25 21:10 dinhanhthi

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

brsma avatar Oct 13 '25 13:10 brsma

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.

github-actions[bot] avatar Dec 07 '25 10:12 github-actions[bot]