BerriAI/litellm · error · NotImplementedError

BedrockFilesConfig does not support file deletion

Error message

BedrockFilesConfig does not support file deletion

What it means

Deleting a Bedrock-backed file would mean deleting the underlying S3 object, which LiteLLM deliberately does not automate, so the request-side delete transform raises NotImplementedError. Bedrock batch files live in your own bucket; lifecycle/cleanup is expected to happen in S3.

Solutions

  1. Delete the object yourself: boto3 delete_object on the bucket/key encoded in the s3:// file id
  2. Use S3 lifecycle rules to expire batch objects instead of per-file deletes
  3. Catch NotImplementedError in shared cleanup code and branch to the S3 path (see pattern)

Example fix

# before
await client.files.delete(file_id)

# after (Bedrock)
bucket, key = file_id[len("s://"):].split("/", 1)  # parse s3://bucket/key
s3.delete_object(Bucket=bucket, Key=key)
Defensive patterns

Strategy: fallback

Validate before calling

def delete_file_for_provider(client, s3, file_id: str, provider: str):
    if provider.startswith("bedrock"):
        bucket, key = file_id[len("s3://"):].split("/", 1)
        s3.delete_object(Bucket=bucket, Key=key)
    else:
        client.files.delete(file_id)

Try / catch

try:
    await client.files.delete(file_id)
except NotImplementedError:
    bucket, key = file_id[len("s3://"):].split("/", 1)
    s3.delete_object(Bucket=bucket, Key=key)

Prevention

When it happens

Trigger: client.files.delete(file_id) / DELETE /v1/files/{id} routed to a bedrock/* model; cleanup jobs written against OpenAI-compatible file deletion.

Common situations: Porting OpenAI batch workflows that delete intermediate files after processing; automated retention scripts hitting the proxy files route.

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/8355400b4a16d773. Report an issue: GitHub.

Appendix: source

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

        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(
        self,
        raw_response: httpx.Response,
        logging_obj: LiteLLMLoggingObj,
        litellm_params: dict,
    ) -> FileDeleted:
        raise NotImplementedError("BedrockFilesConfig does not support file deletion")

    def transform_list_files_request(
        self,
        purpose: str | None,
        optional_params: dict,
        litellm_params: dict,
    ) -> tuple[str, dict]:
        raise NotImplementedError("BedrockFilesConfig does not support file listing")

    def transform_list_files_response(

View on GitHub (pinned to 77b7c6c40c)