BerriAI/litellm · error · NotImplementedError

BedrockFilesConfig does not support file retrieval

Error message

BedrockFilesConfig does not support file retrieval

What it means

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.

Solutions

  1. Track file metadata (id, filename, bytes) from the create_file response yourself — Bedrock files have no server-side metadata record
  2. Read object metadata via boto3 head_object on s3://bucket/key derived from the file id
  3. Use the supported content endpoint (GET /v1/files/{id}/content) to fetch bytes
  4. Gate retrieve calls on provider != bedrock in shared code paths

Example fix

# before
meta = await client.files.retrieve(file_id)

# after (Bedrock: derive from the create response / S3)
from urllib.parse import urlparse
u = urlparse(file_id.replace("s3://", "https://dummy/"))
bucket, key = u.netloc, u.path.lstrip("/")
meta = s3.head_object(Bucket=bucket, Key=key)
Defensive patterns

Strategy: fallback

Validate before calling

def is_bedrock(provider: str) -> bool:
    return provider.startswith("bedrock")

Try / catch

try:
    meta = await client.files.retrieve(file_id)
except NotImplementedError:
    # Bedrock: derive metadata from S3 instead
    bucket, key = file_id[len("s3://"):].split("/", 1)
    meta = s3.head_object(Bucket=bucket, Key=key)

Prevention

When it happens

Trigger: client.files.retrieve(file_id) / litellm.get_file with model="bedrock/..."; proxy route GET /v1/files/{id} routed to the Bedrock files provider.

Common situations: Portable code written against OpenAI's files API being pointed at Bedrock; orchestration UIs that call retrieve after create to poll status.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/526b4da7c70ea249. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/bedrock/files/transformation.py:1173

            purpose="batch",  # Default purpose for Bedrock files
            id=file_id,
            filename=filename,
            created_at=int(time.time()),  # Current timestamp
            status="uploaded",
            bytes=_uploaded_object_size(litellm_params=litellm_params, raw_response=raw_response),
            object="file",
        )

    def get_error_class(self, error_message: str, status_code: int, headers: dict | Headers) -> BaseLLMException:
        return BedrockError(status_code=status_code, message=error_message, headers=headers)

    def transform_retrieve_file_request(
        self,
        file_id: str,
        optional_params: dict,
        litellm_params: dict,
    ) -> tuple[str, dict]:
        raise NotImplementedError("BedrockFilesConfig does not support file retrieval")

    def transform_retrieve_file_response(
        self,
        raw_response: httpx.Response,
        logging_obj: LiteLLMLoggingObj,
        litellm_params: dict,
    ) -> OpenAIFileObject:
        raise NotImplementedError("BedrockFilesConfig does not support file retrieval")

    def transform_delete_file_request(
        self,
        file_id: str,
        optional_params: dict,
        litellm_params: dict,
    ) -> tuple[str, dict]:
        raise NotImplementedError("BedrockFilesConfig does not support file deletion")

    def transform_delete_file_response(

View on GitHub (pinned to 77b7c6c40c)