BerriAI/litellm · error · ValueError

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

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

Configuration guard for Bedrock file content retrieval: no S3 bucket name could be resolved from the server-side proxy config ('s3_bucket_name' in litellm_params) or AWS_S3_BUCKET_NAME env var, so there is no destination bucket for file operations.

Solutions

  1. Set s3_bucket_name in the proxy config.
  2. Set the AWS_S3_BUCKET_NAME environment variable.
  3. Pass s3_bucket_name in the request params.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/llms/bedrock/files/transformation.py:206 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

    trusted_model_credentials: Final = litellm_params.get("_litellm_internal_model_credentials")
    if not isinstance(trusted_model_credentials, MappingProxyType):
        return _TrustedS3ModelCredentials()
    snapshot: Final[dict[str, object]] = {}
    snapshot.update(trusted_model_credentials)  # any-ok: untyped snapshot
    return _TrustedS3ModelCredentials.model_validate(snapshot)


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.
    """
    bucket_name: Final = _trusted_s3_model_credentials(litellm_params).s3_bucket_name or os.getenv("AWS_S3_BUCKET_NAME")
    if not bucket_name:
        raise ValueError(_S3_BUCKET_REQUIRED_ERROR)
    return bucket_name


def get_configured_s3_bucket_names(litellm_params: Mapping[str, object]) -> tuple[str, ...]:
    """
    Resolve the server-configured S3 buckets a Bedrock file id may live in.

    Bedrock batch outputs land in ``s3_output_bucket_name`` when it differs from
    the input bucket, so retrieval validates against both. Same trust rules as
    ``get_configured_s3_bucket_name``: only the immutable credential snapshot or
    the environment, never a request param.
    """
    trusted: Final = _trusted_s3_model_credentials(litellm_params)
    input_bucket: Final = trusted.s3_bucket_name or os.getenv("AWS_S3_BUCKET_NAME")
    output_bucket: Final = trusted.s3_output_bucket_name or os.getenv("AWS_S3_OUTPUT_BUCKET_NAME")
    buckets: Final = tuple(dict.fromkeys(bucket for bucket in (input_bucket, output_bucket) if bucket))
    if not buckets:
        raise ValueError(_S3_BUCKET_REQUIRED_ERROR)

View on GitHub (pinned to 77b7c6c40c)