{"record":{"id":"edc369b88755dce4","repo":"BerriAI/litellm","slug":"bedrock-mantle-auth-failed-no-bearer-token-and-no","errorCode":null,"errorMessage":"Bedrock Mantle auth failed: no Bearer token and no usable AWS credentials. Set BEDROCK_MANTLE_API_KEY (or AWS_BEARER_TOKEN_BEDROCK) or pass api_key for Bearer auth, or provide AWS credentials (IAM role / access key / profile / web identity) for SigV4.","messagePattern":"Bedrock Mantle auth failed: no Bearer token and no usable AWS credentials\\. Set BEDROCK_MANTLE_API_KEY \\(or AWS_BEARER_TOKEN_BEDROCK\\) or pass api_key for Bearer auth, or provide AWS credentials \\(IAM role / access key / profile / web identity\\) for SigV4\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock_mantle/common_utils.py","lineNumber":103,"sourceCode":"        try:\n            return self._aws_signer._sign_request(\n                service_name=\"bedrock\",\n                headers=headers,\n                optional_params=optional_params,\n                request_data=request_data,\n                api_base=api_base,\n                api_key=bearer,\n                model=model,\n                stream=stream,\n                fake_stream=fake_stream,\n            )\n        except (\n            NoCredentialsError,\n            PartialCredentialsError,\n            ProfileNotFound,\n            CredentialRetrievalError,\n        ) as e:\n            raise ValueError(\n                \"Bedrock Mantle auth failed: no Bearer token and no usable AWS \"\n                \"credentials. Set BEDROCK_MANTLE_API_KEY (or AWS_BEARER_TOKEN_BEDROCK) \"\n                \"or pass api_key for Bearer auth, or provide AWS credentials \"\n                \"(IAM role / access key / profile / web identity) for SigV4.\"\n            ) from e\n\n\ndef mantle_supports_responses(model: str | None, model_cost: dict) -> bool:\n    \"\"\"Whether a Bedrock Mantle model can serve the native Responses API.\n\n    Purely data-driven from the model's price-map capability signal -- either\n    /v1/responses in supported_endpoints, or mode=responses -- both overridable\n    via register_model and proxy model_info, so onboarding a model is a JSON\n    change, never a code change. There is deliberately NO model-name match here:\n    capability is per-model, not per-family (openai.gpt-oss-120b supports\n    Responses while openai.gpt-oss-safeguard-120b does not, despite sharing the\n    gpt-oss substring), so a substring gate would be wrong. A model absent from\n    model_cost simply has no signal and returns False (chat-completions emulation).","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock_mantle/common_utils.py#L85-L121","documentation":"Bedrock Mantle (AWS's Bedrock-compatible endpoint) auth tries Bearer first (BEDROCK_MANTLE_API_KEY or AWS_BEARER_TOKEN_BEDROCK env, or api_key), then falls back to the AWS SigV4 chain. When no bearer exists and the chain raises NoCredentialsError, PartialCredentialsError, ProfileNotFound, or CredentialRetrievalError, LiteLLM raises this ValueError chaining the original exception and listing both auth options.","triggerScenarios":"Calling a bedrock_mantle model with no bearer token configured while the AWS credential chain also fails: no env keys, AWS_PROFILE pointing at a missing profile, broken STS/web-identity setup, or no attached IAM role.","commonSituations":"First-time Mantle setups where only one auth method was configured, CI containers without credentials, expired or rotated web identity tokens, renamed AWS profiles.","solutions":["If you have a bearer token: set BEDROCK_MANTLE_API_KEY (or AWS_BEARER_TOKEN_BEDROCK) or pass api_key on the call","Otherwise fix SigV4: valid AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, an existing profile, or a working IAM role / web identity; verify with aws sts get-caller-identity","Inspect the chained original exception (__cause__) to see which chain failure occurred (no creds vs. profile not found vs. retrieval error)"],"exampleFix":"# before\nlitellm.completion(model=\"bedrock_mantle/<model>\", messages=[...])  # raises ValueError\n\n# after (bearer auth)\nos.environ[\"BEDROCK_MANTLE_API_KEY\"] = \"<token>\"\nlitellm.completion(model=\"bedrock_mantle/<model>\", messages=[...])","handlingStrategy":"validation","validationCode":"import botocore.session\n\nhas_bearer = bool(os.environ.get(\"BEDROCK_MANTLE_API_KEY\") or os.environ.get(\"AWS_BEARER_TOKEN_BEDROCK\"))\nhas_sigv4 = botocore.session.get_session().get_credentials() is not None\nif not (has_bearer or has_sigv4):\n    raise SystemExit(\n        \"bedrock_mantle needs a bearer token (BEDROCK_MANTLE_API_KEY) or resolvable AWS credentials\"\n    )","typeGuard":"def bedrock_mantle_auth_ready() -> bool:\n    \"\"\"True when bearer auth or the AWS credential chain is available for Mantle.\"\"\"\n    import os, botocore.session\n    return (\n        bool(os.environ.get(\"BEDROCK_MANTLE_API_KEY\") or os.environ.get(\"AWS_BEARER_TOKEN_BEDROCK\"))\n        or botocore.session.get_session().get_credentials() is not None\n    )","tryCatchPattern":"try:\n    resp = litellm.completion(model=f\"bedrock_mantle/{model}\", messages=msgs)\nexcept ValueError as e:\n    if \"Bedrock Mantle auth failed\" in str(e):\n        raise AuthConfigError(\"set BEDROCK_MANTLE_API_KEY or configure AWS credentials\") from e\n    raise","preventionTips":["Prefer bearer auth (BEDROCK_MANTLE_API_KEY / AWS_BEARER_TOKEN_BEDROCK) for Mantle deployments and set it in the environment","When using SigV4, verify the chain with aws sts get-caller-identity and check AWS_PROFILE exists","Add a startup auth readiness check so misconfiguration fails at boot, not mid-request"],"tags":["bedrock-mantle","authentication","aws-credentials","bearer-token"],"backgroundTag":"missing-credentials","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}