Skip to content

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

Description

@WKassebaum

Environment

  • Platform (select one):
    • Anthropic API
    • AWS Bedrock
    • Google Vertex AI
    • Other:
  • Claude CLI version:
  • Operating System:
  • Terminal:
    Claude Code v1.0.88
    OSX 15.6
    Terminal App
    Context size 90k of 200k

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 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. debugging and editing code - prompt

Expected Behavior

I would expect Claude to not send a prompt to Opus or Sonnet which is mal-formed exciting an Error:400

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 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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions