BerriAI/litellm · error · ValueError

S3 bucket_name is required. Set 's3_bucket_name' in proxy co

Error message

S3 bucket_name is required. Set 's3_bucket_name' in proxy config or AWS_S3_BUCKET_NAME for Bedrock file content retrieval.

What it means

get_configured_s3_bucket_name resolves the server-side bucket only from the immutable internal credential snapshot or the AWS_S3_BUCKET_NAME environment variable — deliberately never from request-supplied params. If neither source yields a bucket, retrieval of Bedrock file content cannot proceed and raises.

Source

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


def get_configured_s3_bucket_name(litellm_params: Mapping[str, object]) -> str:
    """
    Resolve the server-configured S3 bucket for Bedrock file operations.

    Only trusts the immutable server-side credential snapshot or the
    environment; never a request-supplied param, since the bucket is what
    `validate_managed_cloud_file_id` checks file ids against.
    """
    trusted_model_credentials: Final = litellm_params.get("_litellm_internal_model_credentials")
    bucket_name: str | None = None
    if isinstance(trusted_model_credentials, MappingProxyType):
        snapshot: Final[dict[str, object]] = {}
        snapshot.update(trusted_model_credentials)  # any-ok: untyped snapshot
        bucket_name = _TrustedS3ModelCredentials.model_validate(snapshot).s3_bucket_name
    bucket_name = bucket_name or os.getenv("AWS_S3_BUCKET_NAME")
    if not bucket_name:
        raise ValueError(
            "S3 bucket_name is required. Set 's3_bucket_name' in proxy config or AWS_S3_BUCKET_NAME for Bedrock file content retrieval."
        )
    return bucket_name


class BedrockFilesConfig(BaseAWSLLM, BaseFilesConfig):
    """
    Config for Bedrock Files - handles S3 uploads for Bedrock batch processing
    """

    def __init__(self):
        self.jsonl_transformation = BedrockJsonlFilesTransformation()
        super().__init__()

    @property
    def custom_llm_provider(self) -> LlmProviders:
        return LlmProviders.BEDROCK

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Set s3_bucket_name in the proxy config yaml (per-model or general settings) used by the LiteLLM proxy.
  2. Or export AWS_S3_BUCKET_NAME in the server process environment (docker env, k8s secret).
  3. Restart the proxy after adding the setting and verify with a health/config dump.

Example fix

# before: ValueError: S3 bucket_name is required ...

# after (docker):
# docker run -e AWS_S3_BUCKET_NAME=my-bucket ... litellm/proxy
# or litellm_config.yaml:
# litellm_settings:
#   s3_bucket_name: my-bucket
Defensive patterns

Strategy: validation

Validate before calling

import os
assert os.getenv("AWS_S3_BUCKET_NAME") or config.get("s3_bucket_name"), "configure S3 bucket before enabling Bedrock file content"

Prevention

When it happens

Trigger: Fetching file content when the proxy server was not configured with s3_bucket_name (general.yaml/proxy settings) and AWS_S3_BUCKET_NAME is not set in the server process environment.

Common situations: Deploying the proxy without the S3 settings used at file-upload time; env var set in the shell but not in the systemd/docker unit running the proxy; splitting upload and content services with different configs.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/90179efc7c8e554b. Report an issue: GitHub.