{"record":{"id":"b24793485106053f","repo":"BerriAI/litellm","slug":"s3-bucket-name-is-required-set-s3-bucket-name-p","errorCode":null,"errorMessage":"S3 bucket name is required. Set 's3_bucket_name' parameter or {bucket_env_var} env var","messagePattern":"S3 bucket name is required\\. Set 's3_bucket_name' parameter or (.+?) env var","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/common_utils.py","lineNumber":1567,"sourceCode":"        Args:\n            litellm_params: LiteLLM parameters\n            optional_params: Optional parameters\n            bucket_env_var: Environment variable name for bucket\n            key_prefix: Prefix for the S3 key\n\n        Returns:\n            Tuple of (bucket_name, object_key)\n        \"\"\"\n        import time\n\n        from litellm._uuid import uuid\n\n        # Get bucket name\n        bucket_name: Final = (\n            litellm_params.get(\"s3_bucket_name\") or optional_params.get(\"s3_bucket_name\") or os.getenv(bucket_env_var)\n        )\n        if not bucket_name:\n            raise ValueError(f\"S3 bucket name is required. Set 's3_bucket_name' parameter or {bucket_env_var} env var\")\n\n        # Generate unique object key\n        timestamp: Final = int(time.time())\n        unique_id: Final = str(uuid.uuid4())[:8]\n        object_key: Final = f\"{key_prefix}-{timestamp}-{unique_id}\"\n\n        return bucket_name, object_key\n\n    def get_error_class(self, error_message: str, status_code: int, headers: dict | httpx.Headers) -> BaseLLMException:\n        \"\"\"\n        Get Bedrock-specific error class.\n        \"\"\"\n        return BedrockError(status_code=status_code, message=error_message, headers=headers)\n","sourceCodeStart":1549,"sourceCodeEnd":1581,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/common_utils.py#L1549-L1581","documentation":"Raised by BedrockFileTransformation.get_s3_bucket_and_key_from_config when no S3 bucket can be resolved for uploads. The bucket is looked up in three places, in order: litellm_params['s3_bucket_name'], optional_params['s3_bucket_name'], then the environment variable named by bucket_env_var (default AWS_S3_BUCKET_NAME). If all three are empty the call is rejected before any upload is attempted.","triggerScenarios":"Using Bedrock file-based transformations (e.g. large document/file inputs that must be staged in S3) without setting s3_bucket_name in the request/config and without AWS_S3_BUCKET_NAME in the environment; setting the env var in a different shell or process than the one running litellm; passing an empty string instead of omitting the key.","commonSituations":"Proxy configs (config.yaml) missing the s3_bucket_name litellm_param; CI/containers where AWS_S3_BUCKET_NAME was never exported; typos in the env var name; assuming the bucket is derived from AWS credentials (it is not — it must be configured explicitly).","solutions":["Pass s3_bucket_name explicitly: litellm.completion(..., extra_body={'s3_bucket_name': 'my-bucket'}) or set it as a litellm_param in config.yaml","Or export the env var: export AWS_S3_BUCKET_NAME=my-bucket, then restart the proxy/app so it is re-read","Check the value is non-empty and has no quotes/whitespace: print(repr(os.getenv('AWS_S3_BUCKET_NAME')))","If using the proxy, add it to the environment block of your deployment (docker-compose/systemd/k8s env), not just your local shell"],"exampleFix":"# before\nresponse = litellm.completion(model='bedrock/...', messages=..., file_id='...')  # no bucket configured\n\n# after\nresponse = litellm.completion(\n    model='bedrock/...',\n    messages=...,\n    file_id='...',\n    extra_body={'s3_bucket_name': 'my-bucket'},\n)","handlingStrategy":"validation","validationCode":"import os\n\ndef resolve_bucket(litellm_params: dict | None = None) -> str:\n    bucket = (litellm_params or {}).get('s3_bucket_name') or os.getenv('AWS_S3_BUCKET_NAME')\n    if not bucket:\n        raise RuntimeError(\n            'Set s3_bucket_name param or AWS_S3_BUCKET_NAME env var before bedrock file calls'\n        )\n    return bucket\n\nresolve_bucket()  # fail fast at startup/config-load","typeGuard":null,"tryCatchPattern":"try:\n    bucket, key = transformer.get_s3_bucket_and_key_from_config(litellm_params, optional_params)\nexcept ValueError as e:\n    if 's3_bucket_name' in str(e):\n        os.environ.setdefault('AWS_S3_BUCKET_NAME', FALLBACK_BUCKET)\n        bucket, key = transformer.get_s3_bucket_and_key_from_config(litellm_params, optional_params)\n    else:\n        raise","preventionTips":["Configure s3_bucket_name once in config.yaml rather than per request","Add AWS_S3_BUCKET_NAME to your deployment env spec (compose/k8s manifest)","Add a config-validation step that fails startup when the bucket is unresolved"],"tags":["bedrock","s3","configuration","missing-env-var","valueerror"],"backgroundTag":"missing-env-var","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}