Anyone hitting the below error when running claude code?
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"The request body is not valid JSON: invalid high surrogate in string: line 47 column 5162 (char 45482)"}}
I am getting excessive errors , such as:
⎿ API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.
Anyone else getting the same type of error. Using Claude 2.0.10 version.
Hey everyone,
I wanted to share a solution for a specific error I’ve been encountering in Claude Code. After using a session for a few hours, the conversation compaction fails, and I get locked out with this API Error 400:
Error: Error during compaction: Error: API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"messages.7.content.1: \thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response."}}`
Simply closing the terminal or restarting didn't fix it for me immediately. However, I found a specific workflow that forces the compaction to go through.
The Solution:
-
Close the terminal completely.
-
Open a new terminal and run claude--resume and choose your conversation
-
When the error appears (or before you type anything else), change the model by typing /model
-
Then select sonnet 4.5
-
Send a simple prompt like: "What happened bro?"
-
This seems to force the conversation to compact successfully without the error.
-
Once the compaction is done, use /model again to switch back to your preferred model (eg. Opus 4.5) and continue coding.
I hope this saves someone the headache I went through these 3-4 days.