BerriAI/litellm · error · Exception

Unable to map Bedrock request to provider

Error message

Unable to map Bedrock request to provider

What it means

On the batch path (batch_data built for providers that chunk inputs, e.g. cohere/titan/twelvelabs), the delegated _async_func_embeddings/_single_func_embeddings call returned None, so there is nothing to hand back to the caller. It signals an internal dispatch/mapping failure rather than an AWS error.

Source

Thrown at litellm/llms/bedrock/embed/embedding.py:517

                    provider=provider,
                    is_async_invoke=has_async_invoke,
                )
            returned_response: Final = self._single_func_embeddings(
                client=(client if client is not None and isinstance(client, HTTPHandler) else None),
                timeout=timeout,
                batch_data=batch_data,
                credentials=credentials,
                extra_headers=extra_headers,
                endpoint_url=endpoint_url,
                aws_region_name=aws_region_name,
                model=model,
                logging_obj=logging_obj,
                api_key=api_key,
                provider=provider,
                is_async_invoke=has_async_invoke,
            )
            if returned_response is None:
                raise Exception("Unable to map Bedrock request to provider")
            return returned_response
        elif data is None:
            raise Exception("Unable to map Bedrock request to provider")

        headers = {"Content-Type": "application/json"}
        if extra_headers is not None:
            headers = {"Content-Type": "application/json", **extra_headers}

        prepped: Final = self.get_request_headers(
            credentials=credentials,
            aws_region_name=aws_region_name,
            extra_headers=extra_headers,
            endpoint_url=endpoint_url,
            data=json.dumps(data),
            headers=headers,
            api_key=api_key,
        )

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Upgrade litellm to pick up new provider transformations.
  2. Reproduce with a single-element input list to see the underlying mapping error more directly.
  3. Confirm the model id exactly matches a supported provider model.
  4. Report model + litellm version upstream if the model is supported.
Defensive patterns

Strategy: fallback

Try / catch

try:
    resp = litellm.embedding(model=model, input=inputs)
except Exception as e:
    if "Unable to map Bedrock request to provider" in str(e):
        return litellm.embedding(model=FALLBACK_MODEL, input=inputs)
    raise

Prevention

When it happens

Trigger: Input list length > 1 (or provider requires batching) routes to the batch branch; a provider sub-path returns None from _transform_response (see error 1263) which propagates up as this wrapper exception.

Common situations: Same root causes as 1263 (unmapped/new model response shape), surfaced on multi-input embedding calls instead of single-input calls.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/1502d09899639359. Report an issue: GitHub.