[BUG] API Error: 400: ... invalid JSON .. in prompt.

Resolved 💬 3 comments Opened Aug 22, 2025 by WKassebaum Closed Aug 26, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [x] Other: <!-- specify -->
  • Claude CLI version: <!-- output of claude --version -->
  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
  • Terminal: <!-- e.g. iTerm2, Terminal App -->

Claude Code v1.0.88
OSX 15.6
Terminal App
Context size 90k of 200k

Bug Description

<!-- A clear and concise description of the bug -->

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 131554 (char

131553)"},"request_id":"req_011CSPWrWStU2RzGjKwZWGLo"}

fix typecheck 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 85080 (char
85079)"},"request_id":"req_011CSPWuSeGyfchdCvE8CsiV"}

/compact

⎿ Error: Error during compaction: 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 54528 (char 54527)"},"request_id":"req_011CSPWvpYBRSwJALFbwS8VC"}

This cannot be cleared by /compact. No further API commands will work. I have to exit claude and start a new session in order to continue working.

Steps to Reproduce

  1. <!-- First step --> debugging and editing code - prompt
  2. <!-- Second step -->
  3. <!-- And so on... -->

Expected Behavior

<!-- What you expected to happen -->
I would expect Claude to not send a prompt to Opus or Sonnet which is mal-formed exciting an Error:400

Actual Behavior

<!-- What actually happened -->
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 131554 (char
131553)"},"request_id":"req_011CSPWrWStU2RzGjKwZWGLo"}

This cannot be cleared by /compact. No further API commands will work. I have to exit claude and start a new session in order to continue working.

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
BashOutput(Reading shell output)
⎿  > @claude-codeindex/claude-code-integration@0.9.0 start-service
> node dist/service-cli.js
… +549 lines (ctrl+r to expand)
⎿  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 131554 (char
131553)"},"request_id":"req_011CSPWYyPP23SKr4HaQp3Wb"}

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗