"Prompt is too long"
The request — history, files the agent read, tool results — exceeds the model's context window. Claude Code normally compacts before this happens; when it doesn't, the next turn dies with a 400. Fixes: /compact to summarise, /clear to start fresh with a short brief, or switch to a (1M) model variant for genuinely large work.
Two recent reports are worth knowing about because the meter lies in them: #82226 found claude-opus-5 requests enforced at roughly 200K on some accounts while the client displayed a 1M window — every failure landed between 166K and 178K tokens; #93808 (September 2026) reports CLI 2.1.26x rejecting >200K prompts on a Max subscription that an older version served at 664K. If /context says you have room and you still get Prompt is too long around 170–200K, you're probably in that situation: compact below ~150K, or try another model or CLI version.
"API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation."
The conversation history contains tool calls and tool results that don't match — the API requires every tool_result to answer a tool_use in the previous assistant turn. The big wave was #8763 (270 comments, October 2025). Anthropic's own follow-ups there: "there's actually a bunch of root causes", then "recommend 2.0.24 or newer", then "this is fixed — make sure you're on the latest version (claude update)".
It still happens after heavy sessions: #40305 traced it to orphan tool_result blocks left behind by context compaction — and there /rewind didn't help, only /clear did. The same family shows up as messages.2: tool_use ids were found without tool_result blocks immediately after.
/rewind # step back to before the broken turn
/clear # if /rewind doesn't recover it: fresh context, re-brief
claude update
Other 400s you'll meet
invalid_request_error: messages.N: …— a malformed history, same fixes as above.This organization has been disabled.— account-level; contact Anthropic support or use a different account/endpoint. No client fix exists.Output blocked by content filtering policy— the response tripped a filter (#88062); rephrase the task.API Error: 400 status code (no body)with aclaude setup-tokentoken — an open issue (#86986) where freshly minted long-lived tokens are rejected on the first request; interactive login on the same machine works. Workaround until fixed: use/loginor an API key.- Credit-balance 400s despite available balance (#91322) — a billing-side validation problem; log out and back in, then contact support.
400 on a gateway
A 400 is about the request, so it behaves identically on Anthropic direct and through this gateway (ANTHROPIC_BASE_URL=https://aiprimetech.io): the same /compact, /rewind and /clear fixes apply. One gateway-specific case: a model id the endpoint doesn't serve returns an error too — check /v1/models.
Frequently asked questions
What does Claude API Error 400 mean?
The API rejected the request as invalid. The text after it says why — prompt too long, a broken tool-call history, an account problem or a content filter — and retrying unchanged won't help.
How do I fix 'Prompt is too long' in Claude Code?
Run /compact, or /clear and re-brief, or switch to a 1M-context model variant. If it fails around 170–200K while /context shows room, compact below ~150K.
How do I fix 'API Error: 400 due to tool use concurrency issues'?
Run /rewind; if that doesn't recover the session, /clear. Update Claude Code with claude update — Anthropic fixed several root causes in 2.0.24 and later.
Run Claude Code on the gateway
Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan.
Get an API key See unlimited plansAI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.