Bedrock: Opus 4.7 rejects all beta flags with 'invalid beta flag' error

Resolved 💬 3 comments Opened Apr 17, 2026 by WhiteVMW Closed Apr 20, 2026

Summary

Claude Code v2.1.112 sends beta flags (e.g. claude-code-20250219, interleaved-thinking-2025-05-14) to Amazon Bedrock when using global.anthropic.claude-opus-4-7, but Bedrock's Opus 4.7 rejects all beta flags with a 400 error.

Environment

  • Claude Code: v2.1.112
  • Provider: Amazon Bedrock (CLAUDE_CODE_USE_BEDROCK=1)
  • Auth: Bedrock API Key (AWS_BEARER_TOKEN_BEDROCK)
  • Region: ap-northeast-1
  • Model: global.anthropic.claude-opus-4-7 (inference profile, ACTIVE)

Error

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"invalid beta flag"}}

Root Cause

Three places in cli.js add beta flags that Opus 4.7 on Bedrock does not accept:

  1. KR function — already filters iv1 set for Bedrock, but iv1 does not include claude-code-20250219
  2. DV8 function — when isAgenticQuery=true, forcibly pushes claude-code-20250219 even if KR returned []
  3. WV1.buildRequest — converts anthropic-beta header to body.anthropic_beta without stripping unsupported flags

Verification

Opus 4.6 (global.anthropic.claude-opus-4-6-v1) accepts claude-code-20250219 on Bedrock — this is an Opus 4.7-specific regression.

Direct API calls with no beta flags work fine:

curl -X POST https://bedrock-runtime.ap-northeast-1.amazonaws.com/model/global.anthropic.claude-opus-4-7/invoke \
  -H "Authorization: Bearer $AWS_BEARER_TOKEN_BEDROCK" \
  -d '{"anthropic_version":"bedrock-2023-05-31","max_tokens":32,"messages":[{"role":"user","content":"hi"}]}'
# → 200 OK

Workaround

In DV8, skip the isAgenticQuery push for Opus 4.7 on Bedrock.
In WV1.buildRequest, delete q.body.anthropic_beta when the model includes opus-4-7.

Related

  • v2.1.101 fixed CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS not suppressing beta headers for Bedrock/Vertex — similar class of issue.
  • global.anthropic.claude-opus-4-7 inference profile was added to Bedrock on 2026-04-15.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗