Troubleshooting guides
Each guide starts from the exact error text an LLM API or SDK prints, then gives the cause in one sentence, a copy-paste fix, a checklist and the official sources.
400 invalid_request_error: prompt is too long
The input you sent is already larger than the model's context window, so the Claude API rejects it before generating anything.JSONDecodeError: Unterminated string starting at
The JSON ends in the middle of a string, which with LLM output almost always means the reply hit its output-token limit before the object was finished.finish_reason: "length"
The model stopped because it reached the maximum number of output tokens set in the request, so the reply is incomplete.529 overloaded_error
The Claude API is temporarily overloaded across all users, so it refused the request; nothing is wrong with your request or your limits.429 RESOURCE_EXHAUSTED
Your Gemini API requests went over a rate limit or quota for your project, so the API refused this one.429 insufficient_quota
Your OpenAI organization, project or key has run out of credits or hit a spend or usage limit, so every request is refused until that changes.GraphRecursionError: Recursion limit of … reached without hitting a stop condition
Your LangGraph agent ran the maximum number of steps without reaching an end state, usually because it keeps calling the same tool or bouncing between nodes.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
The connection closed while a streamed (chunked) response was still coming, so your HTTP client got only part of the reply."cached_tokens": 0
The start of your prompt changed between calls or was too short to cache, so the provider found no matching cached prefix and billed the full input again.APITimeoutError: Request timed out.
The SDK gave up waiting for the API before a response arrived, usually because the reply is long, the model is slow, or the timeout is too short for the job.
See also: Error index · Failure modes · Context planner