{"record":{"id":"526b4da7c70ea249","repo":"BerriAI/litellm","slug":"bedrockfilesconfig-does-not-support-file-retrieval","errorCode":null,"errorMessage":"BedrockFilesConfig does not support file retrieval","messagePattern":"BedrockFilesConfig does not support file retrieval","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/files/transformation.py","lineNumber":1173,"sourceCode":"            purpose=\"batch\",  # Default purpose for Bedrock files\n            id=file_id,\n            filename=filename,\n            created_at=int(time.time()),  # Current timestamp\n            status=\"uploaded\",\n            bytes=_uploaded_object_size(litellm_params=litellm_params, raw_response=raw_response),\n            object=\"file\",\n        )\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | Headers) -> BaseLLMException:\n        return BedrockError(status_code=status_code, message=error_message, headers=headers)\n\n    def transform_retrieve_file_request(\n        self,\n        file_id: str,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> tuple[str, dict]:\n        raise NotImplementedError(\"BedrockFilesConfig does not support file retrieval\")\n\n    def transform_retrieve_file_response(\n        self,\n        raw_response: httpx.Response,\n        logging_obj: LiteLLMLoggingObj,\n        litellm_params: dict,\n    ) -> OpenAIFileObject:\n        raise NotImplementedError(\"BedrockFilesConfig does not support file retrieval\")\n\n    def transform_delete_file_request(\n        self,\n        file_id: str,\n        optional_params: dict,\n        litellm_params: dict,\n    ) -> tuple[str, dict]:\n        raise NotImplementedError(\"BedrockFilesConfig does not support file deletion\")\n\n    def transform_delete_file_response(","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/files/transformation.py#L1155-L1191","documentation":"Bedrock's files mapping stores uploads directly in your S3 bucket; there is no Bedrock 'get file metadata' API to translate, so the request-side transform for retrieval is deliberately unimplemented. Attempting GET /v1/files/{file_id} against a bedrock deployment raises NotImplementedError at request-transform time.","triggerScenarios":"client.files.retrieve(file_id) / litellm.get_file with model=\"bedrock/...\"; proxy route GET /v1/files/{id} routed to the Bedrock files provider.","commonSituations":"Portable code written against OpenAI's files API being pointed at Bedrock; orchestration UIs that call retrieve after create to poll status.","solutions":["Track file metadata (id, filename, bytes) from the create_file response yourself — Bedrock files have no server-side metadata record","Read object metadata via boto3 head_object on s3://bucket/key derived from the file id","Use the supported content endpoint (GET /v1/files/{id}/content) to fetch bytes","Gate retrieve calls on provider != bedrock in shared code paths"],"exampleFix":"# before\nmeta = await client.files.retrieve(file_id)\n\n# after (Bedrock: derive from the create response / S3)\nfrom urllib.parse import urlparse\nu = urlparse(file_id.replace(\"s3://\", \"https://dummy/\"))\nbucket, key = u.netloc, u.path.lstrip(\"/\")\nmeta = s3.head_object(Bucket=bucket, Key=key)","handlingStrategy":"fallback","validationCode":"def is_bedrock(provider: str) -> bool:\n    return provider.startswith(\"bedrock\")","typeGuard":null,"tryCatchPattern":"try:\n    meta = await client.files.retrieve(file_id)\nexcept NotImplementedError:\n    # Bedrock: derive metadata from S3 instead\n    bucket, key = file_id[len(\"s3://\"):].split(\"/\", 1)\n    meta = s3.head_object(Bucket=bucket, Key=key)","preventionTips":["Branch files-API calls on provider; only OpenAI-style providers implement retrieve","Persist the create_file response — it is the only metadata source for Bedrock files","Use /v1/files/{id}/content (implemented) when you need the payload itself"],"tags":["bedrock","files-api","unsupported-operation","litellm"],"backgroundTag":"unsupported-operation","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}