{"record":{"id":"9bfbff13dcbd0dd3","repo":"BerriAI/litellm","slug":"bedrockexception-timeout-error-error-str","errorCode":null,"errorMessage":"BedrockException: Timeout Error - {error_str}","messagePattern":"BedrockException: Timeout Error - (.+?)","errorType":"exception","errorClass":"Timeout","httpStatus":408,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":883,"sourceCode":"            llm_provider=\"bedrock\",\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"AccessDeniedException\" in error_str:\n        raise PermissionDeniedError(\n            message=f\"BedrockException PermissionDeniedError - {error_str}\",\n            model=model,\n            llm_provider=\"bedrock\",\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"throttlingException\" in error_str or \"ThrottlingException\" in error_str:\n        raise RateLimitError(\n            message=f\"BedrockException: Rate Limit Error - {error_str}\",\n            model=model,\n            llm_provider=\"bedrock\",\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"Connect timeout on endpoint URL\" in error_str or \"timed out\" in error_str:\n        raise Timeout(\n            message=f\"BedrockException: Timeout Error - {error_str}\",\n            model=model,\n            llm_provider=\"bedrock\",\n        )\n    elif \"Could not process image\" in error_str:\n        raise litellm.InternalServerError(\n            message=f\"BedrockException - {error_str}\",\n            model=model,\n            llm_provider=\"bedrock\",\n        )\n    elif hasattr(original_exception, \"status_code\"):\n        if original_exception.status_code == 500:\n            raise ServiceUnavailableError(\n                message=f\"BedrockException - {original_exception.message}\",\n                llm_provider=\"bedrock\",\n                model=model,\n                response=httpx.Response(\n                    status_code=500,","sourceCodeStart":865,"sourceCodeEnd":901,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/exception_mapping_utils.py#L865-L901","documentation":"LiteLLM throws Timeout when Bedrock connectivity or inference exceeds time limits: 'Connect timeout on endpoint URL' (botocore failing to establish the TCP/TLS connection) or 'timed out' (request exceeded the client's timeout). The mapper normalizes both into litellm.Timeout so callers get one uniform type with the model attached. Unlike string-mapped branches, no response object is attached.","triggerScenarios":"Slow non-streaming generations exceeding the configured litellm timeout (default 600s); network egress blocked to bedrock-runtime.<region>.amazonaws.com:443; DNS/proxy/VPC-endpoint misconfiguration producing botocore ConnectTimeoutError.","commonSituations":"Corporate proxies that must allow-list AWS endpoints; long max_tokens generations without streaming; VPC endpoints with broken private DNS; aggressive per-request timeouts set via timeout=/request_timeout.","solutions":["Raise the timeout: litellm.completion(..., timeout=300) or request_timeout, and set num_retries to ride out transient slowness","Switch to streaming for long outputs so time-to-first-token governs instead of full-generation wall clock","Verify network egress to bedrock-runtime.<region>.amazonaws.com:443 and corporate proxy configuration","Check DNS / VPC endpoint resolution if connect timeouts (not read timeouts) recur"],"exampleFix":"# before\nresp = litellm.completion(model=\"bedrock/...\", messages=msgs)  # Connect timeout on endpoint URL\n\n# after\nresp = litellm.completion(model=\"bedrock/...\", messages=msgs, timeout=300, num_retries=2, stream=True)","handlingStrategy":"retry","validationCode":null,"typeGuard":"import litellm\n\ndef is_timeout(e: BaseException) -> bool:\n    return isinstance(e, litellm.Timeout)","tryCatchPattern":"try:\n    resp = litellm.completion(model='bedrock/...', messages=msgs, timeout=300)\nexcept litellm.Timeout:\n    resp = litellm.completion(model='bedrock/...', messages=msgs, timeout=300, stream=True, num_retries=2)","preventionTips":["Use streaming for any generation that can exceed a few dozen seconds","Set explicit timeout= sized to worst-case generation, not the 600s default","Allow-list bedrock-runtime.<region>.amazonaws.com:443 on corporate proxies","Distinguish connect vs read timeouts: connect failures point at network/DNS, not model speed"],"tags":["bedrock","timeout","network","botocore"],"backgroundTag":"request-timeout","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}