
The Claude Code Bedrock invalid beta flag error means your request carried a feature label that Bedrock, or a gateway in front of it, won’t accept. Your AWS account and your project are fine. The fix is to stop sending that one label.
Run claude update first, because newer versions retry without the rejected label. Next, remove any custom value you added through ANTHROPIC_BETAS. If you reach Bedrock through a gateway, set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 before you start Claude Code.
If the error is still there, switch the gateway to the Bedrock route with CLAUDE_CODE_USE_BEDROCK=1, or ask its team which label was refused. Each step is below, along with the other Bedrock errors people hit: credentials, 403, region, model ID and streaming.
Browse all our Claude Code tutorials for more fixes and how-tos.
Tested with Claude Code v2.1.330 on macOS on November 22, 2026. We ran Claude Code against a small stand-in server on the same computer, set to answer with the exact error text, so no request went to AWS. Steps inside AWS follow Anthropic’s official docs.
Quick Summary
| What you see | Likely cause | Fix |
|---|---|---|
400 invalid beta flag | A beta value was refused | Update, then turn experimental betas off |
Extra inputs are not permitted | A beta field arrived without its header | Forward both, or turn betas off |
Could not load AWS credentials | No usable credentials on your computer | Sign in to AWS again |
AWS authentication failed | Expired token or missing permission | Refresh, then check IAM and model access |
| on-demand throughput isn’t supported | Plain model ID | Use an inference profile ID |
Bedrock streaming response has content-type | A gateway rewrote the stream | Pass the stream through untouched |
What “Invalid Beta Flag” Means on Bedrock
Claude Code uses features that are still in preview. Each one has a label with a date, such as context-management-2025-06-27, and Claude Code sends those labels with every request. The docs call them anthropic-beta values.
Bedrock accepts a smaller set of labels than Anthropic’s own API. When a label outside that set arrives, the whole request is refused with a 400. Your prompt never reaches the model.
Here is the error we reproduced, followed by the setting that cleared it:

Why it usually happens behind a gateway
Many companies put a gateway between Claude Code and Bedrock. If you point at it with ANTHROPIC_BASE_URL, the docs say Claude Code treats it as the Claude API and can’t tell which service it forwards to. So it sends the full list of labels.
With CLAUDE_CODE_USE_BEDROCK=1, the docs say Claude Code sends only the labels Bedrock accepts. We logged both routes to see the difference.


The betas command in these shots is our own small script that prints the server’s log. The exact list depends on your version and model, so treat ours as an example. When we pinned Sonnet 4.6, for instance, one value disappeared.

The error names no value, so your job is to shorten the list until the refused one is gone.
How to Fix the Claude Code Bedrock Invalid Beta Flag Error
Work through these in order. Restart Claude Code after each change, because it reads these variables when it starts.

Fix 1: Update Claude Code
claude update
claude --versionRecent versions can drop a refused label and try again on their own. The docs say most of the values this covers need v2.1.314 or later.
For a bare “invalid beta flag” with no name, Claude Code has to guess which label was refused. In our test on v2.1.330, it guessed right for the thinking token count label and for tool search. It didn’t recover when we refused the context management, per-turn control or interleaved thinking label.

Fix 2: Remove values you added with ANTHROPIC_BETAS
ANTHROPIC_BETAS adds your own labels to requests. The docs warn that a value Claude Code doesn’t recognize stays on every request, so you keep getting the 400. The off switch in Fix 3 doesn’t remove it either.

Check your shell first, then look in the env block of your settings files. Not sure where those are? See settings.json locations.
echo $ANTHROPIC_BETAS
unset ANTHROPIC_BETASWe saw one difference on the Bedrock route. Our made-up value wasn’t sent at all there, so this fix matters most with ANTHROPIC_BASE_URL.
Fix 3: Turn experimental betas off
export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1
claudeTo make it stick, put it in a settings file instead:
{
"env": {
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
}
}In our logs this cut the list to three labels on both routes: claude-code, interleaved-thinking and effort. It also removed the context_management and defer_loading fields, which cause similar 400 errors.

There is a cost. You lose context management and MCP tool search, so every MCP tool loads upfront. In our test, the number of tools sent with each request went from 12 to 22 on the Anthropic route and to 20 on the Bedrock route.
Fix 4: Use the Bedrock route on your gateway
Ask your gateway team if they offer a Bedrock address. If they do, use this block from the docs instead of ANTHROPIC_BASE_URL:
unset ANTHROPIC_BASE_URL
export ANTHROPIC_BEDROCK_BASE_URL=https://llm-gateway.example.com/bedrock
export CLAUDE_CODE_SKIP_BEDROCK_AUTH=1
export CLAUDE_CODE_USE_BEDROCK=1The skip setting is for gateways that hold the AWS credentials for you. If the gateway needs its own token, add ANTHROPIC_AUTH_TOKEN and keep the skip setting on.

Fix 5: Find the label that is being refused
Fix 3 leaves the interleaved thinking label on. When our server refused that one, CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 still failed, and this setting cleared it:
export DISABLE_INTERLEAVED_THINKING=1The better long-term fix belongs to whoever runs the gateway. If the error names the label, Claude Code can remove just that one. We changed our server to answer with the Unexpected value(s) sentence, and the second request went through.

Send your gateway team the gateway compatibility guide. It asks them to forward anthropic-beta unchanged and pass error messages through without rewording them.
Other Claude Code Bedrock Setup Errors
Extra inputs are not permitted
This is a close cousin. The label and its matching field should travel together, and this 400 appears when only the field arrives or the upstream doesn’t know it. Update to v2.1.305 or later, then use Fix 3 if you need to.
Our error 400 guide covers other causes.
Could not load AWS credentials
Claude Code found nothing to sign in with, so no request left your computer. We got it by turning Bedrock on with no AWS profile or keys set:

Sign in again and confirm it worked outside Claude Code:
aws sso login --profile your-profile-name
export AWS_PROFILE=your-profile-name
aws sts get-caller-identityIf the message ends with “default-chain credential resolve timed out,” your sign-in step stalled for 60 seconds. Finish any browser sign-in before you start Claude Code. For slow sign-ins, raise CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS.
AWS authentication failed (403)
Bedrock uses a 403 for both an expired token and a missing permission, so Claude Code can’t tell which one you have. Our test server’s 403 produced this message:
AWS authentication failed · refresh your AWS credentials (SSO sign-in, access keys, API key or proxy token) and retry · if credentials are current, check AWS permissions and model access · API Error: 403 ...Refresh your credentials first. If that doesn’t help, check three things from the docs:
- Your IAM policy allows
bedrock:InvokeModel,bedrock:InvokeModelWithResponseStream,bedrock:ListInferenceProfilesandbedrock:GetInferenceProfile. - Someone submitted the use case form for Anthropic models in your AWS account. It’s needed once per account.
- The model is enabled for your account and region.
Wrong region
Run /status to see which region and model Claude Code settled on. It checks AWS_REGION, then AWS_DEFAULT_REGION, then your AWS profile, and falls back to us-east-1.

The region also decides the model prefix, such as us. or eu. in front of the model name.
If your account only has global. profiles, set ANTHROPIC_BEDROCK_REGION_PREFIX=global.

On-demand throughput isn’t supported
The docs’ fix is to specify the model as an inference profile ID. Those have a region prefix:
export ANTHROPIC_MODEL='us.anthropic.claude-sonnet-4-6'Run aws bedrock list-inference-profiles --region your-region to see the IDs your account has. If Claude Code says the model itself is the problem, see our selected model error guide.
Bedrock streaming response has content-type “text/event-stream”
Bedrock streams its answers in a binary format. This error means a gateway turned that into something else:

The gateway should pass the response body and its Content-Type through unchanged. The setting named in the message only hides the check, and the docs say those requests then take a slower path.
Try It Yourself
Before you change anything, print the variables that choose your route. This shows names only, so no keys appear on screen:
env | grep -E '^(ANTHROPIC|CLAUDE_CODE|AWS|DISABLE)_' | cut -d= -f1 | sortIf you see both ANTHROPIC_BASE_URL and CLAUDE_CODE_USE_BEDROCK, decide which route you want and unset the other. Then test with one short prompt:
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 claude -p "Reply with the word ready."A reply here but not without the prefix means a preview label or its matching field was the problem.
Common Mistakes
- Copying a list of beta labels from a forum into
ANTHROPIC_BETAS. Claude Code already sends the ones it needs. - Letting a gateway strip
anthropic-betabut keep the request body. That trades this error for “Extra inputs are not permitted.” - Setting
AWS_BEARER_TOKEN_BEDROCKalongside a gateway token. The docs say the Bedrock key is sent instead. - Changing a variable in one terminal while Claude Code runs in another.
- Using a Bedrock model ID such as
us.anthropic.claude-sonnet-4-6on the Mantle endpoint, which has its own IDs.
Pro Tips
- Pin model versions for a team. The docs warn that aliases such as
opuscan point to a model your account doesn’t have yet. - Run
/setup-bedrockto change your credentials, region or model pins in a wizard. - Remove the off switch from time to time and retest. Gateways get updated, and you’ll want tool search back.
- Keep route settings in one place. Our list of environment variables shows what each one does.
For the full setup from scratch, follow our Bedrock setup guide. If a company proxy is also in the way, see corporate proxy setup.
Cheat Sheet

Frequently Asked Questions
Is the invalid beta flag error a problem with my AWS account?
Usually not. It’s about what the request contains, so your credentials and permissions aren’t the cause. Account trouble tends to show up as a credentials error or a 403.
Which beta flag is invalid?
A bare “invalid beta flag” doesn’t say. Ask your gateway team to check their logs, or shorten the list with the off switches until the error stops.
What do I lose with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1?
You lose preview features such as context management and MCP tool search, plus some beta tool fields. The effort and interleaved thinking labels stay on.
Can I get this error without a gateway?
It’s less likely, because Claude Code limits what it sends on the Bedrock route. If it happens, update Claude Code, check ANTHROPIC_BETAS, then try the off switches. Our common errors guide helps with anything else.
Does WebSearch work in Claude Code on Bedrock?
No. The Amazon Bedrock docs say the WebSearch tool isn’t available there, so a missing search tool isn’t a setup mistake.
Conclusion
The Claude Code Bedrock invalid beta flag error comes down to one preview label that Bedrock or your gateway won’t take. Update Claude Code, clear ANTHROPIC_BETAS, and set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 if you go through ANTHROPIC_BASE_URL; moving to the Bedrock route is the cleaner fix when your gateway offers it. In our tests on v2.1.330, an error that named the label let Claude Code recover with no changes at all, so it’s worth asking for. To learn more about the models you’re connecting to, see our overview of Claude AI.


