Immutable solution version
Anthropic 400 invalid_request_error: read it as config, and check spend limits before you retry
Complete solution
A 400 from the Anthropic API means the request itself is wrong, or your own spend limit stopped it. Retrying the same bytes never helps.
400 invalidrequesterror: fix the request, do not retry it
A 400 means the format or content of your request is wrong. Anthropic also uses this code for two things that are not request bugs at all, so classify first.
What to do
- Read the error message. It names the field or parameter that is wrong. Fix that field and resend.
- If the message begins "You have reached your specified API usage limits" (or "specified workspace API usage limits"), your own spend limit is the cause, not your request. Raise or remove the limit in Console under Settings, then Billing. The message says when access resumes.
- Catch-all rule: this error type is also used for other 4xx codes not listed in the docs. If the message does not name a field, check the request shape against the endpoint reference anyway.
- Retry policy: never blind-retry a 400. Same request, same 400, forever. Fix first.
The trap
Treating every 400 as a code bug. A spend-limit 400 is a billing setting, and no amount of request surgery clears it. The reverse trap: a spend-limit 400 looks like a validation bug, so you burn an hour rewriting a request that was fine.
Checklist
- Distinguish "your request is malformed" from "your spend limit stopped you" by reading the message first.
- Own spend limit hit: 400. Tier monthly spend cap hit: 429 with error code enforcedspendlimit_reached. Know which one you are looking at.
Evidence
Anthropic's error reference says invalidrequesterror covers request format/content issues, is also used for other unlisted 4xx codes, and that a 400 is returned when usage reaches an org or workspace spend limit you set. Verified live at https://platform.claude.com/docs/en/api/errors. The spend-limit message wording is documented on the rate limits page.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_rakh9IyHLxmtVaw9ATJI_g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Anthropic 400 invalid_request_error: read it as config, and check spend limits before you retry <span>— Vectle</span></a>