[BUG] Getting "invalid beta flag" error despite CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1

Resolved 💬 16 comments Opened Jan 29, 2026 by igor-makarov Closed Jan 29, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

This began occurring on 2.1.23. Version 2.1.22 does not have the issue.

When running with CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 in the env, CC uses some beta flag, which is passed on to Bedrock, causing an error.

What Should Happen?

Claude Code runs

Error Messages/Logs

API Error: 400 {"error":{"message":"{\"message\":\"invalid beta flag\"}. 
Received Model Group=claude-opus-4-5-20251101
Available Model Group Fallbacks=None","type":"None","param":"None","code":"400"}}  

Steps to Reproduce

Run 2.1.23 against Bedrock

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.22

Claude Code Version

2.1.23

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

View original on GitHub ↗

16 Comments

github-actions[bot] · 5 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/20031

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

igor-makarov · 5 months ago

This is not a duplicate - started happening in 2.1.23 only.

schaveyt · 5 months ago

Definitely something in 2.1.23.

We doing this

# 1.  Add DISABLE_AUTOUPDATER=1 to env vars

# 2. install 2.1.22 native
([scriptblock]::Create((irm https://claude.ai/install.ps1))) 2.1.22

The issue is gone.

igor-makarov · 5 months ago

But I want 2.1.23, it finally lets me (hopefully) get rid of spinner verb slop.

MikeSpreitzer · 5 months ago

I was able to use 2.1.23 yesterday. But today I am getting this same failure on everything I try.

igor-makarov · 5 months ago

By the way the offending header is prompt-caching-scope-2026-01-05.

I hacked my installation to not send it and it "fixed" it.

LiteLLM is not "firstParty"!

MikeSpreitzer · 5 months ago

Yes, I am using LiteLLM.

Is there a way that I can see the requests that claude code is sending?

BTW, I ripped everything out and started over with version 2.1.22, and am succeeding.

MikeSpreitzer · 5 months ago

Too quick. A very simple request succeeds. A harder one fails. Oh, wait. I have 2.1.23! Even though I told the install script to get 2.1.22.

MikeSpreitzer · 5 months ago

What happened here?

<img width="589" height="464" alt="Image" src="https://github.com/user-attachments/assets/e60d000c-53fe-4108-969d-656c1db94535" />

<img width="588" height="463" alt="Image" src="https://github.com/user-attachments/assets/ccc80218-f449-485f-b7fa-353ee30aa6ec" />

How did it slip from 2.1.22 to 2.1.23?

igor-makarov · 5 months ago
Yes, I am using LiteLLM. Is there a way that I can see the requests that claude code is sending? BTW, I ripped everything out and started over with version 2.1.22, and am succeeding.

I've managed to do this by running a local LiteLLM proxy with --detailed_debug.

BUT - the thing that figured out the fix was Claude Code reverse-engineering the minified JS in search of beta headers.

szwang · 5 months ago

Thanks so much for reporting. We just shipped v2.1.25 with the fix, and you should be able to avoid the error now (keep setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1). So sorry for the friction, closing now but please let me know if you're still seeing any issues.

igor-makarov · 5 months ago

@szwang it might be useful to have a way to differentiate between "firstParty" and LiteLLM and such. Something like env THIRD_PARTY_PROVIDER=1.

I'm required by my employer to use the LiteLLM setup and there are always papercuts, like having to have specific model slugs or various beta params shenanigans like this issue here.

It feels like these go unnoticed until it makes a lot of noise.

bdavj · 5 months ago
Thanks so much for reporting. We just shipped v2.1.25 with the fix, and you should be able to avoid the error now (keep setting CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1). So sorry for the friction, closing now but please let me know if you're still seeing any issues.

@szwang Thanks for the fix - do we loose anything by setting this beta flag? We've only seen this issue come up starting today (we hadn't updated beyond ~2.1.20 at that stage), whereby the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS flag was needed at all -

  • Is there a reason the flag is now needed?
  • Is there a longer term fix so that the flag isn't needed?
  • Do we loose anything by disabling the experimental betas at this stage?

We can confirm that 2.1.22 still works without the CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS flag, so something has changed in 23-25.

Ideally this wouldn't require setting an environment variable. Can Claude Code use the API URL to determine if its connecting to a Gateway or Anthropic, and if not, can we have an environment variable that more accurately blankets "connecting through a gateway" as opposed to experimental betas.

Thanks!

szwang · 5 months ago

@igor-makarov We hear you on the papercuts here :/ Better accommodating gateways is something we're discussing, but the tricky thing is that different third party providers also have different quirks. We've documented our gateway requirements here and recommend following those standards, which would have avoided this (i.e. gateways should forward beta headers).

Of course, we definitely anticipate this behavior and do a better job of catching regressions! But it is hard to generalize into a single flag. I hope that makes sense. Would also love to know what your other issues are.

szwang · 5 months ago

@bdavj

Do we loose anything by setting this beta flag?

There are certain Claude API beta features that you might lose, but nothing major. When features GA we update accordingly so all users get them.

Is there a reason the flag is now needed?

It tells us that you do not want us to the beta header, or send fields that require it. The bug was due to a code change that didn't take the env var flag into account.

Is there a longer term fix so that the flag isn't needed?

Nothing is planned at the moment. Curious what your ideal would be/

Can Claude Code use the API URL to determine if its connecting to a Gateway or Anthropic, and if not, can we have an environment variable that more accurately blankets "connecting through a gateway" as opposed to experimental betas.

We could and are considering it.

Hope that helps!

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.