{"record":{"id":"b2209f397c3d2261","repo":"BerriAI/litellm","slug":"e-message","errorCode":null,"errorMessage":"{e.message}","messagePattern":"\\{e\\.message\\}","errorType":"http","errorClass":"HTTPException","httpStatus":null,"severity":"error","filePath":"litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py","lineNumber":863,"sourceCode":"                    if key != \"user_api_key_dict\":  # Don't overwrite user_api_key_dict\n                        litellm_params[key] = value\n\n        verbose_proxy_logger.debug(\"Count tokens litellm_params: %s\", litellm_params)\n        verbose_proxy_logger.debug(\"Resolved model: %s\", resolved_model)\n\n        # Handle the count tokens request\n        result: Final = await handler.handle_count_tokens_request(\n            request_data=request_body,\n            litellm_params=litellm_params,\n            resolved_model=resolved_model,\n        )\n\n        return result\n\n    except BedrockError as e:\n        # Convert BedrockError to HTTPException for FastAPI\n        verbose_proxy_logger.error(\"BedrockError in handle_bedrock_count_tokens: %s\", e)\n        raise HTTPException(status_code=e.status_code, detail={\"error\": e.message})\n    except HTTPException:\n        # Re-raise HTTP exceptions as-is\n        raise\n    except Exception as e:\n        verbose_proxy_logger.error(\"Error in handle_bedrock_count_tokens: %s\", e)\n        raise HTTPException(status_code=500, detail={\"error\": f\"CountTokens processing error: {e}\"})\n\n\nasync def bedrock_llm_proxy_route(\n    endpoint: str,\n    request: Request,\n    fastapi_response: Response,\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n):\n    \"\"\"\n    Handles Bedrock LLM API calls.\n\n    Supports both direct Bedrock models and router models from config.yaml.","sourceCodeStart":845,"sourceCodeEnd":881,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py#L845-L881","documentation":"Re-raise site in the Bedrock CountTokens except-block: a BedrockError raised by handle_count_tokens_request is converted into a FastAPI HTTPException carrying the upstream status code and the provider's original error message in the detail body.","triggerScenarios":"Thrown at litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py:863 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This surfaces an AWS BedrockError; check the embedded message and status code for the specific Bedrock failure (auth, throttling, model access).","Verify AWS credentials/region and that the requested Bedrock model is enabled in your account."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}