Home / Blog / Pricing

Pricing

Claude Code "API Error: 400": What Each Version Means and How to Fix It

Claude Code says "API Error: 400"? What each 400 variant means (tool_use IDs, invalid list, request too large), the fixes from Anthropic's GitHub issues.

9 min read

Error strings quoted from Claude Code GitHub issues #106055, #101518, #100579, #92316 and #106148 (verified Nov 3, 2026, re-checked Nov 4, 2026). Meanings and fixes checked Nov 4, 2026 in Claude Code’s error reference and Anthropic’s API error docs. Every source is listed at the bottom. No affiliate links on this page (how we work).

The exact error: API Error: 400 (and the part after it)

Here’s the family. Every one of these is a real line from a GitHub issue on Anthropic’s Claude Code repo:

API Error: 400 messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01NfUFbKddwvBUzR8oppUBYq. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.
API Error: 400 messages.3.content.88: `server_tool_use` ids must be unique per assistant turn
API Error: 400 messages.1.content: Input should be a valid list
API Error: 400 invalid params, messages.4.content.1.tool_use.input: Input should be a valid dictionary (2013)

Sources: #106055, #101518, #100579 and #92316, verified Nov 3, 2026.

The one-line answer: a 400 means the API rejected the request Claude Code sent as invalid, and the text after “400” tells you why. Anthropic’s API docs define 400 invalid_request_error as “There was an issue with the format or content of your request” (verified Nov 4, 2026). It isn’t Anthropic’s servers being busy, and it isn’t your login.

The annoying part, and the reason people end up searching this, is what happens next. In most of these reports, the broken piece sits in the conversation history. So every message you send after it carries the same broken history, and every message gets the same 400. You type “test”, it fails. You type “please”, it fails. It’s like asking the same question twice and getting Jim’s look straight down the camera both times, the one he gave Dwight’s bear question: that’s a ridiculous question.

Which 400 is yours? Read the suffix

The number is always 400. The suffix is what matters. Here’s what each one is, based only on what the issue reporters and Anthropic’s docs say.

“unexpected tool_use_id” and “server_tool_use ids must be unique”

These are the two tool-ID errors: #106055 (opened Oct 29, 2026, Claude Code 2.1.312, macOS) and #101518 (opened Oct 12, 2026, 2.1.296, macOS). The #101518 reporter says they “can’t move forward with my session.” Both issues were open with no maintainer reply as of Nov 4, 2026, and GitHub has labeled #101518 a duplicate.

Anthropic’s error reference doesn’t list these two exact lines. It does have a section called “Tool use or thinking block mismatch” covering close relatives such as API Error: 400 ... unexpected tool_use_idfound intool_result blocks and API Error: 400 duplicate tool_use ID in conversation history. Its explanation: “the sequence of tool_use, tool_result, and thinking blocks in history no longer matches what the API expects” (verified Nov 4, 2026). Anthropic hasn’t said whether the advisor and server_tool_use versions have the same cause, so treat that as a likely match, not a confirmed one.

“Input should be a valid list” after /compact

#100579 (opened Oct 8, 2026, labeled “has repro”) is the one people hit after compacting. The reporter ran /compact, and after that “all my prompts afterwards in the session return ‘API Error: 400 messages.1.content: Input should be a valid list’.” They were on Claude Code 2.1.294 through Amazon Bedrock with an API key, saw it with both Sonnet 5.5 and Opus 5.5, and marked it as a regression. Their way out: “I must create a new session.” The issue was open with no maintainer reply as of Nov 4, 2026.

If you’re on Bedrock or a proxy, note that. It’s part of the report, though Anthropic hasn’t said it’s limited to Bedrock.

“Input should be a valid dictionary (2013)”

#92316 (opened Sep 5, 2026, Windows, VS Code terminal, Anthropic API) has the tool_use.input version. The reporter says it first appeared after a long prompt full of nested code blocks and LaTeX. After that, every input in the session failed. Here’s the frustrating bit: they ran claude update from 2.1.220 to 2.1.261 and the error stayed. As of Nov 4, 2026 the issue is open, labeled “stale”, and has no replies. Two months of silence on a bug that bricks a session is not a great look.

The request-size 400 (Vertex AI, 30 MB)

#106148 (opened Oct 30, 2026) is a different animal. A long Cowork session in Claude Desktop, routed through a LiteLLM gateway to Google Vertex AI, failed with:

API Error: 400 litellm.BadRequestError: Vertex_aiException BadRequestError
"message": "The message size (30037042 bytes) exceeds 30.000MB limit.",
"status": "FAILED_PRECONDITION"

The reporter’s point: the limit is in bytes, not tokens, so a bigger context window doesn’t help, and the session didn’t compact and retry on its own. Retrying and asking for a summary failed the same way. “A new chat works.” It was open as of Nov 4, 2026.

On the direct Claude API, Claude Code’s docs describe a separate 32MB request limit with its own message, Request too large (max 32MB), and say that “Through a proxy, gateway, or cloud provider you get the general message” (verified Nov 4, 2026). Anthropic’s API docs list a 128 MB Messages API maximum on the first-party API and send you to the platform docs for others. Long story short: if your 400 mentions message size, it’s the payload, not your prompt wording.

How to fix Claude Code API Error 400, in order

Each step says where it comes from. None of this is a guess on our part.

  1. Step back past the broken turn with /rewind (or press Esc twice). Per Claude Code’s error reference, this is the fix for tool use and thinking block mismatches: it steps “back to a checkpoint before the corrupted turn” (verified Nov 4, 2026). Think of it as the Community dice roll in reverse: you’re going back to a timeline before things went dark, instead of staying in the darkest timeline sending “test” over and over.
  2. Update Claude Code with claude update. Per the error reference, several 400 loops were fixed in specific versions. Versions before v2.1.156 can trigger the tool-use mismatch on Opus 4.7 and 4.8. Versions before v2.1.246 could fail every turn of a resumed session after a proxy left unsupported tool content. Versions before v2.1.282 kept a refused redacted_thinking block. The docs say to update and resume the session. One caveat, reported in #92316: updating didn’t clear that user’s dictionary error.
  3. Start fresh with /clear or a new session. This is what the reporters in #100579 and #106148 used, and the error reference suggests /clear when the request is too big for compacting to help. You lose the conversation context, but you get a working session back.
  4. Don’t keep resuming the broken session. Every reporter above describes the same thing: once the bad block is in the history, every new message fails. Sending it again sends the same broken history again.
  5. For request-size 400s, shrink the payload. Per the error reference: run /compact (it drops accumulated images and attachments), or reference large files by path instead of pasting them. If you’re on Bedrock or Vertex, check that provider’s request-size limit. #106148 shows Vertex enforcing its own 30 MB cap.
  6. Report it with /feedback. Anthropic’s troubleshooting page points there, and it gives the team a session to look at.

What not to do: don’t hand-edit session files you don’t understand, don’t route through random “fixer” proxies, and don’t make a second account. A malformed request is malformed on every account.

400 vs 401 vs 429 vs 529

CodeMeaningPost
400Request invalidYou’re here
400 “too long”Context fullPrompt too long
401Auth problemInvalid API key
429Rate or spend capUsage limits
529Servers busy529 overloaded

Meanings from Anthropic API errors and the Claude Code error reference, verified Nov 4, 2026.

Two notes. If the message says “Prompt is too long”, read Claude Code prompt is too long, because that one has its own fixes. If it’s a 401, Claude Code invalid API key covers it. And Anthropic’s API docs add a twist: the API “also returns a 400 when usage reaches an organization or workspace spend limit you set” (verified Nov 4, 2026). So if you’re on an API key with a spend limit and the 400 doesn’t mention messages or tools, check that first.

If the session died with no 400 at all and simply hung, that’s a different problem: see Claude Code timed out. Busy servers are covered in Claude Code 529 overloaded.

Does a 400 use up my Claude usage?

Not published. Anthropic’s docs say a 529 doesn’t count against your quota, but they don’t say the same, or the opposite, about a 400. We won’t guess. Check /usage in Claude Code if you want to see where you stand.

Here’s what I’d do

Read the suffix first. Tool IDs or “tool_use”: /rewind to before the bad turn, then claude update. “Valid list” after /compact: start a new session, because that’s what the reporter had to do and there’s no official fix yet. Message size: compact or start fresh, and check your provider’s cap. If the same 400 keeps coming back on a fresh session, file it with /feedback.

If these session-killing bugs keep eating your afternoons, it’s fair to keep a backup tool warm. Our Claude Code alternatives list and AI coding tools compared page cover the options with dated prices.

Seeing a 403 “Request not allowed” or access-grant refusal instead of a 400? See Claude Code API Error 403.

A 401 is a different failure from a 400 request error: Claude Code API Error 401.

FAQ

What does API Error: 400 mean in Claude Code? It means the API rejected the request as invalid (400 invalid_request_error), and the text after “400” names the broken part, such as a tool_use block or the request size.

How do I fix Claude Code API Error 400 after /compact? The reporter of GitHub issue #100579 had to start a new session; there’s no official fix for that bug as of Nov 4, 2026, so use /clear or a new session.

How do I fix API Error: 400 messages.1.content: Input should be a valid list? Start a new session or run /clear, because the broken message stays in the history and every later prompt fails (GitHub issue #100579).

What does server_tool_use ids must be unique per assistant turn mean? The conversation history has a tool block the API won’t accept; Claude Code’s docs say to run /rewind or press Esc twice to go back before the corrupted turn.

Does a 400 error use my Claude usage limit? Not published; Anthropic documents that a 529 doesn’t count against your quota but says nothing either way about 400 errors.

Why does Claude Code give a 400 on Vertex AI for message size? Vertex AI caps request payloads at 30 MB in bytes, and GitHub issue #106148 reports that the session doesn’t compact and retry when it hits that cap.

Sources

  1. Claude Code GitHub issue #106055 (unexpected tool_use_id in advisor_tool_result; open): https://github.com/anthropics/claude-code/issues/106055 (verified 2026-11-03, re-checked 2026-11-04)
  2. Claude Code GitHub issue #101518 (server_tool_use ids must be unique; open, labeled duplicate): https://github.com/anthropics/claude-code/issues/101518 (verified 2026-11-03, re-checked 2026-11-04)
  3. Claude Code GitHub issue #100579 (/compact then “Input should be a valid list”; open): https://github.com/anthropics/claude-code/issues/100579 (verified 2026-11-03, re-checked 2026-11-04)
  4. Claude Code GitHub issue #92316 (“Input should be a valid dictionary (2013)”; open, stale): https://github.com/anthropics/claude-code/issues/92316 (verified 2026-11-03, re-checked 2026-11-04)
  5. Claude Code GitHub issue #106148 (Vertex AI 30 MB 400 FAILED_PRECONDITION; open): https://github.com/anthropics/claude-code/issues/106148 (verified 2026-11-03, re-checked 2026-11-04)
  6. Claude Code error reference (tool use or thinking block mismatch, /rewind, version fixes, Request too large): https://code.claude.com/docs/en/errors (verified 2026-11-04)
  7. Anthropic API errors (400 invalid_request_error, spend-limit 400, 413 and request size limits): https://docs.claude.com/en/api/errors (verified 2026-11-04)
  8. Claude Code troubleshooting (/doctor, /feedback): https://code.claude.com/docs/en/troubleshooting (verified 2026-11-04)

Related reading