{"record":{"id":"12994785a9c48d5b","repo":"BerriAI/litellm","slug":"failed-to-download-file-from-s3-s3-uri-error","errorCode":null,"errorMessage":"Failed to download file from S3: {s3_uri}. Error: {e}","messagePattern":"Failed to download file from S3: (.+?)\\. Error: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/files/handler.py","lineNumber":133,"sourceCode":"            aws_sts_endpoint=optional_params.get(\"aws_sts_endpoint\"),\n        )\n\n        # Create S3 client\n        s3_client: Final = boto3.client(\n            \"s3\",\n            aws_access_key_id=credentials.access_key,\n            aws_secret_access_key=credentials.secret_key,\n            aws_session_token=credentials.token,\n            region_name=aws_region_name,\n            verify=self._get_ssl_verify(),\n        )\n\n        # Download file from S3\n        try:\n            response: Final = s3_client.get_object(Bucket=bucket_name, Key=object_key)\n            file_content: Final = response[\"Body\"].read()\n        except Exception as e:\n            raise ValueError(f\"Failed to download file from S3: {s3_uri}. Error: {e}\")\n\n        # Create mock HTTP response\n        mock_response: Final = httpx.Response(\n            status_code=200,\n            content=file_content,\n            headers={\"content-type\": \"application/octet-stream\"},\n            request=httpx.Request(method=\"GET\", url=s3_uri),\n        )\n\n        return HttpxBinaryResponseContent(response=mock_response)\n\n    def file_content(\n        self,\n        _is_async: bool,\n        file_content_request: FileContentRequest,\n        api_base: str | None,\n        optional_params: dict,\n        timeout: float | httpx.Timeout,","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/files/handler.py#L115-L151","documentation":"Error-mapping wrapper around the S3 GetObject call in file download: after successfully parsing the s3:// URI and creating the client, s3_client.get_object raised (missing object, permissions, region issues), and the error is re-raised with the URI and cause for diagnostics.","triggerScenarios":"Thrown at litellm/llms/bedrock/files/handler.py:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the S3 URI is correct and the object exists.","Check IAM permissions allow s3:GetObject on the bucket.","Check network/credentials used for the S3 download."],"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-23T08:17:48.524Z"}