Skip to content

fix(bedrock): forward the server-side-fallback beta and drop it under drop_params where the model lacks it (lts/1.108.x) - #54386

Merged
mateo-berri merged 4 commits into
BerriAI:lts/1.108.xfrom
izzybn:litellm_bedrock_server_side_fallback_beta_lts_1_108_x
Nov 25, 2026
Merged

mateo-berri merged 4 commits into
BerriAI:lts/1.108.xfrom
izzybn:litellm_bedrock_server_side_fallback_beta_lts_1_108_x

Conversation

@izzybn

@izzybn izzybn commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

This brings the server-side-fallback beta fix from #53857 to lts/1.108.x, so a /v1/messages conversation that carries a Claude fallback block works on Bedrock Invoke and Bedrock Mantle there too. It is the LTS twin of #53857, which is merged, with every commit of it picked

Original

TLDR

Problem this solves:

  • /v1/messages with a fallback block in history 400s on Bedrock Invoke and Mantle
  • The proxy drops server-side-fallback-2026-06-01 on both
  • Calling those platforms directly with that beta answers 200

How it solves it:

  • Forward the June beta in the bedrock and bedrock_mantle beta columns
  • Mark server-side-fallback-2026-07-01 null there, since both reject it
  • Add a supports_server_side_fallback capability for Claude 4.5 and newer
  • Under drop_params, drop the June beta for models without it
  • Sync the Rust beta table and the Rust Mantle path

Intentional product change: Opus 4.1 on Bedrock Invoke with the June beta and no drop_params now gets the provider's 400 invalid beta flag, as a direct call does. With drop_params the beta is dropped

User Flow

Before: a developer replaying a conversation that hit a server-side fallback gets a 400 on Bedrock

  1. They send POST http://localhost:4000/v1/messages to a Bedrock Invoke or Mantle Claude model with anthropic-beta: server-side-fallback-2026-06-01
  2. The history has an assistant turn with a fallback content block, streaming or not
  3. The proxy answers 400 Input tag 'fallback' found using 'type' does not match any of the expected tags

After: the same request answers 200, the same as calling the platform directly

  1. They send the same request with the same fallback history, streaming or not
  2. The proxy answers 200 with the model's reply
  3. On Opus 4.1 with drop_params: true the proxy drops the beta and answers 200. Without drop_params it answers the provider's 400 invalid beta flag

Relevant issues

LTS twin of #53857

Backport

Picks, every non-merge commit of #53857 through 2a70196

The merge commit 608f5cd on #53857 is not picked

Main commit LTS commit On the line
d47bf27 28b63cb adapted, one commit with the next row
66d7353 28b63cb adapted, Invoke and Mantle only
62ff40f 53f9e98 adapted, Python only
2a70196 e9db5cd adapted, Python only

The line has no Databricks /v1/messages module and nothing reads its databricks beta column, so main's Databricks drop check has nowhere to go. The column rows are still picked so the bundled table matches main. The line runs Bedrock /v1/messages on Python, so main's Rust Invoke drop check and its Rust base_model lookup have no reader here. The merge of lts/1.108.x keeps one SERVER_SIDE_FALLBACK_2026_06_01 enum member, since the line added the same member in 42dea5b

Tests and make check
  • Picked and nearby tests at 8124aa5 (bedrock messages and chat, anthropic, beta filtering): 5694 passed, 4 failed. The same 4 fail at the line's tip 595a02e, so the picks cause none
  • Rust cargo test -p litellm-llms-types -p litellm-llms --lib -- beta bedrock_mantle: 200 passed
  • make check passes at 8124aa5

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Both legs ran one proxy with 2 workers, a Redis and its own Postgres, calling real Bedrock (us-east-1), with LITELLM_LOCAL_ANTHROPIC_BETA_HEADERS=True and LITELLM_LOCAL_MODEL_COST_MAP=True so each leg reads its own tree's beta table and cost map. Configs, payloads, every command and its full output are in the QA gist

Case Before (595a02e) After (8124aa5)
Invoke, June beta, fallback history 400 200
Invoke, same, streaming 400 200
Invoke, July beta, fallback history 400 400
Mantle, June beta, fallback history 400 200
Mantle, same, streaming 400 200
Mantle, July beta, fallback history 400 400
Haiku 4.5 Invoke, drop_params, June beta, fallback history 400 200
Opus 4.1 Invoke, June beta, first turn 200 400
Opus 4.1 Invoke, drop_params, June beta, first turn 200 200
Opus 4.1 Invoke, same, streaming 200 200
Example calls

Before (595a02e)

Invoke, June beta, fallback history

  1. Send the fallback history to the Bedrock Invoke model with the June beta, which answers 400
$ curl -sS -m 120 -w '\nHTTP %{http_code}' -H 'Authorization: Bearer $KEY' -H 'content-type: application/json' -H 'anthropic-beta: server-side-fallback-2026-06-01' http://127.0.0.1:24811/v1/messages -d @fallback-fallback-beta-bedrock.json
{"type":"error","error":{"type":"invalid_request_error","message":"litellm.BadRequestError: BedrockException - {\"message\":\"messages.1.content.1: Input tag 'fallback' found using 'type' does not match any of the expected tags: 'connector_text', 'document', 'image', 'mid_conv_system', 'redacted_thinking', 'search_result', 'server_tool_use', 'text', 'thinking', 'tool_result', 'tool_search_tool_result', 'tool_use'\"}\n\nLiteLLM: model group 'fallback-beta-bedrock' failed with the error above. No fallback was attempted."}}
HTTP 400

Opus 4.1 Invoke, drop_params, June beta, first turn

  1. Send a first turn to Opus 4.1 on a drop_params deployment with the June beta, which answers 200 since the line's table drops the beta
$ curl -sS -m 120 -w '\nHTTP %{http_code}' -H 'Authorization: Bearer $KEY' -H 'content-type: application/json' -H 'anthropic-beta: server-side-fallback-2026-06-01' http://127.0.0.1:24811/v1/messages -d @first-opus41-drop.json
{"model":"opus41-drop","id":"msg_bdrk_01C5Myu6jbcHSVuXx3htSr2W","type":"message","role":"assistant","content":[{"type":"text","text":"Hello! How can I help you today?"}],"stop_reason":"max_tokens","stop_sequence":null,"usage":{"input_tokens":8,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10}}
HTTP 200

After (8124aa5)

Invoke, June beta, fallback history

  1. Send the same request, which answers 200 with the model's reply
$ curl -sS -m 120 -w '\nHTTP %{http_code}' -H 'Authorization: Bearer $KEY' -H 'content-type: application/json' -H 'anthropic-beta: server-side-fallback-2026-06-01' http://127.0.0.1:24812/v1/messages -d @fallback-fallback-beta-bedrock.json
{"model":"fallback-beta-bedrock","id":"msg_bdrk_d4yojhv6ip2sqqksrltrbjekojmgog5ixhci7i7en2luuloh5sdq","type":"message","role":"assistant","content":[{"type":"thinking","thinking":"","signature":"CAQS6QMKEggUEAEYAjgBQgh0aGlua2luZxIMxxpxcaU/i2VJ0nwMGgyz8RoEw94ZriAY+LoiMIgZNPWjJvufp7x4+90CCM8iZGd6Q0Lcu4sOVQEhWRAooVNQHdpoG7nZAEPnTeDUsCqEAxG5KOeeZ4uFXFq/jnM6+j+k5fBHw+UDF5W+O6U0k7kyUIbKUbvI5ih6dHTrFbPtqpqU9feDFKHCIDZT/Dj1jKVB+rSbDa5rY1nRWUW3rfcEPlrQb6IS4ZDidEGd1iElobbKMcB/XDQyPG9K5jBNpRBy23DcDWBoC6hGPvw22UEZANGX+U5nBmhEADDU1Rw2TQ+IUtNkhdeRbJJ1PwPdSgo2z7qXh5Oshg7hB1m3OR+5hdrWNmdmSz0t3cH+B/XkDXig+DCFMPbw3t3x9JdL7JQK1pI7GuFMsjlRmCZ235QLW43iy8TVcnPIA0KL0G+SYgrLsWrgQPGy0oHY1/Ds37fysYKd3dwOKaLH31aJ1HL0Xk2DI4j9z+tTXh7Y1YTjFbA0FCtPk79yVH6z76XLvcT/NYnKVAN7jDTik0TttNeKLC2n/IQdGH77gfA8JYPNeyYrFK1kvkPrUHGE8jutQMAYjZH40q6da3BbEgYEJEIdkaaQZqkK1u/2CPlx7oNLxclMiIEYAQ=="}],"container":null,"stop_reason":"max_tokens","stop_sequence":null,"stop_details":null,"usage":{"input_tokens":20,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"iterations":[{"input_tokens":20,"output_tokens":10,"cache_read_input_tokens":0,"cache_creation_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"type":"message","model":null}],"output_tokens":10,"output_tokens_details":{"thinking_tokens":10},"service_tier":"standard"}}
HTTP 200

Opus 4.1 Invoke, drop_params, June beta, first turn

  1. Send the same request, which answers 200
  2. The proxy log shows the drop
$ curl -sS -m 120 -w '\nHTTP %{http_code}' -H 'Authorization: Bearer $KEY' -H 'content-type: application/json' -H 'anthropic-beta: server-side-fallback-2026-06-01' http://127.0.0.1:24812/v1/messages -d @first-opus41-drop.json
{"model":"opus41-drop","id":"msg_bdrk_016xXpw3XMoV65JqKQHqsQxA","type":"message","role":"assistant","content":[{"type":"text","text":"Hello! How can I help you today?"}],"stop_reason":"max_tokens","stop_sequence":null,"usage":{"input_tokens":8,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":10}}
HTTP 200
LiteLLM:WARNING: common_utils.py:478 - Dropping the server-side-fallback-2026-06-01 beta for model=us.anthropic.claude-opus-4-1-20250805-v1:0 (drop_params=True): neither its model_info nor the model cost map lists server-side fallback support for it. Set model_info.supports_server_side_fallback: true on a deployment whose model supports it.

Type

🐛 Bug Fix

Caveats (if any)

Copied from #53857, whose caveat review stopped at its 4-round cap, without its Databricks rows

High

  • Opus 4.1 + June beta without drop_params now answers 400 on Bedrock Invoke
    • That is the drop_params convention, so set drop_params: true
  • Released LTS builds without this drop check forward the June beta even under drop_params
    • They download main's beta table at boot, so Opus 4.1 + June beta + drop_params answers 400 invalid beta flag there
    • Upgrade, or set LITELLM_LOCAL_ANTHROPIC_BETA_HEADERS=True

Medium

  • Bedrock Mythos Preview drops the June beta under drop_params, since the cost map lists no server-side fallback support for it
    • If it takes the beta, set model_info.supports_server_side_fallback: true
  • The base_model lookup for a profile ARN has unit tests only, since no proxy route reaches the drop check with an ARN today

Low

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
Bugbot summary

[!NOTE]
Medium Risk
Changes request transformation for Bedrock /v1/messages and anthropic-beta handling; Opus 4.1 without drop_params now surfaces the provider’s invalid-beta 400 instead of silently accepting the header.

Overview
Fixes Bedrock Invoke / Mantle (and beta table sync for Databricks) so /v1/messages histories with a fallback content block can succeed when callers send server-side-fallback-2026-06-01.

The proxy now forwards server-side-fallback-2026-06-01 in anthropic_beta_headers_config.json for bedrock, bedrock_mantle, and related columns, while dropping server-side-fallback-2026-07-01 (platforms reject it). Rust AnthropicBeta types and Mantle header merging are updated to match.

A new deployment capability supports_server_side_fallback is added to the model cost map (Claude 4.5+) and ModelInfo. When drop_params is on, without_unsupported_server_side_fallback_beta strips the June beta on models that lack support (e.g. Opus 4.1 on Bedrock), with a verbose warning; deployments can override via model_info.supports_server_side_fallback. Bedrock Invoke’s message transform applies this after normal beta filtering.

Unit tests cover beta forwarding/remapping and per-model drop behavior.

Reviewed by Cursor Bugbot for commit 8124aa5. Bugbot is set up for automated code reviews on this repo. Configure here.

…tle and drop it under drop_params where the model lacks it

Bedrock Invoke, Bedrock Mantle and Databricks Claude need server-side-fallback-2026-06-01 for a fallback-block
history, so the bundled beta table forwards the June beta in their columns and nulls July, matching main

Opus 4.1 rejects the June beta with 400 invalid beta flag. A supports_server_side_fallback capability, resolved from
a claude-server-side-fallback cost-map rule (Claude 4.5 and newer) or the deployment's model_info, lets drop_params
drop the beta on Bedrock Invoke and Mantle for a model that lacks it. Without drop_params the beta still goes through
and Bedrock answers its own 400
@veria-ai

veria-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with no actionable issues found

Summary

Forwards the June server-side fallback beta on Bedrock Invoke and Mantle, rejects the July spelling, and adds model-aware dropping under drop_params in Python

  • Bedrock and Databricks forward the June fallback beta.
  • Bedrock Invoke drops the fallback beta for unsupported models.

No actionable issues were found. This review checked source code and did not run tests

izzybn explicitly identifies the Opus 4.1 rejection without drop_params as intentional. The description also acknowledges unset Mythos support, unit-only ARN coverage, unchanged Vertex and Azure behavior, extra capability metadata, and four existing adapter test failures

Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'origin/lts..." · Reviewed by Greptile

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8124aa5. Configure here.

@codecov

codecov Bot commented Nov 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mateo-berri
mateo-berri merged commit 5da336d into BerriAI:lts/1.108.x Nov 25, 2026
117 of 121 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants