Skip to content

[Bug]: Signature mismatch when falling back to Bedrock in async_function_with_fallbacks #13738

@aunt-bitsy

Description

@aunt-bitsy

What happened?

We’re hitting frequent signature mismatch errors when LiteLLM fallbacks attempt to route to Bedrock

What I've noticed:

  • The error shows content-type:application/json, application/json which looks like a duplicate header that gets canonicalized into a comma-joined value

  • The request URL contains a ":" , but the message shows 1%3A. This mismatch could be throwing off the signature calculation

  • These errors only seem to happen when the prompt is too long.

    1. For Anthropic/Vertex we correctly get prompt is too long errors.
    2. But when falling back to Bedrock, it instead fails with this signature mismatch.
  • I can’t reproduce the issue just by passing an oversized text prompt. Possibly related to additional payload (a base64 image in the request)

these are requests that should fail. But for some reason Bedrock gives the “wrong” error message.

Relevant log output

litellm.router.py::async_function_with_fallbacks() - Error occurred while trying to do fallbacks - {"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been\n'POST\n/model/us.anthropic.claude-sonnet-4-20250514-v1%3A0/invoke-with-response-stream\n\nanthropic-version:2023-06-01\ncontent-type:application/json, application/json\

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

v1.74.15-stable

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions