{"record":{"id":"e8e5e49f74050224","repo":"BerriAI/litellm","slug":"raw-response-text-e8e5e4","errorCode":null,"errorMessage":"raw_response.text","messagePattern":"raw_response\\.text","errorType":"http","errorClass":"BedrockError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/files/transformation.py","lineNumber":1254,"sourceCode":"\n        empty_body_hash: Final = hashlib.sha256(b\"\").hexdigest()\n        aws_request: Final = AWSRequest(  # any-ok: botocore AWSRequest is untyped\n            method=\"GET\",\n            url=api_base,\n            headers={\"x-amz-content-sha256\": empty_body_hash},\n        )\n        auth: Final = S3SigV4Auth(credentials, \"s3\", aws_region_name)  # any-ok: botocore untyped\n        auth.add_auth(aws_request)  # any-ok: botocore request mutation is untyped\n        return dict(aws_request.headers)  # any-ok: botocore headers are untyped\n\n    def transform_file_content_response(\n        self,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,\n        litellm_params: dict,\n    ) -> HttpxBinaryResponseContent:\n        if raw_response.status_code >= 400:\n            raise BedrockError(\n                status_code=raw_response.status_code,\n                message=raw_response.text,\n                headers=raw_response.headers,\n            )\n        return HttpxBinaryResponseContent(response=raw_response)\n\n\nclass BedrockJsonlFilesTransformation:\n    \"\"\"\n    Transforms OpenAI /v1/files/* requests to Bedrock S3 file uploads for batch processing\n    \"\"\"\n\n    def transform_openai_file_content_to_bedrock_file_content(\n        self, openai_file_content: FileTypes | None = None\n    ) -> tuple[str, str]:\n        \"\"\"\n        Transforms OpenAI FileContentRequest to Bedrock S3 file format\n        \"\"\"","sourceCodeStart":1236,"sourceCodeEnd":1272,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/files/transformation.py#L1236-L1272","documentation":"While transforming the Bedrock S3 GetObject response for /v1/files/<id>/content, LiteLLM checks the HTTP status and, for any status >= 400, raises BedrockError carrying the upstream status code, raw response body (raw_response.text), and headers. The 'message' is literally the S3 error XML/body, e.g. 'AccessDenied' or 'The specified key does not exist'.","triggerScenarios":"GET on bedrock://<bucket>/<key> returning 403 (bad credentials / wrong bucket), 404 (object key deleted or never uploaded), or 400 from S3; i.e. any file-content download where S3 rejects the signed request.","commonSituations":"Expired STS credentials used to sign the GetObject; file id referencing an object removed by a bucket lifecycle rule; cross-region bucket access denied; requesting content for a file uploaded under a different AWS account/profile.","solutions":["Read the BedrockError message body — S3 returns '<Code>...</Code>' (e.g. NoSuchKey, AccessDenied) which names the root cause.","For 404/NoSuchKey: re-upload the batch file and use the new file id; check bucket lifecycle rules.","For 403: verify the AWS credentials litellm resolved (env vars, profile, or STS role) have s3:GetObject on that bucket/key prefix.","Confirm bucket region matches aws_region_name used for signing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.exceptions import BedrockError\n\ntry:\n    content = litellm.file_content(file_id=bedrock_file_id)\nexcept BedrockError as e:\n    if e.status_code == 404:\n        # object gone: re-upload or surface 'not found'\n        ...\n    elif e.status_code == 403:\n        # credentials/bucket perms: alert ops\n        ...\n    else:\n        raise","preventionTips":["Store the file id returned by upload and use it verbatim; don't reconstruct S3 keys by hand.","Verify s3:GetObject IAM permissions for the signing credentials before shipping.","Treat 404 on batch input files as a signal to refresh uploads after bucket lifecycle changes."],"tags":["bedrock","s3","files","http-error","download"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}