{"record":{"id":"55aafdaefb32d586","repo":"BerriAI/litellm","slug":"focus-s3-bucket-name-must-be-provided-for-s3-expor","errorCode":null,"errorMessage":"FOCUS_S3_BUCKET_NAME must be provided for S3 exports","messagePattern":"FOCUS_S3_BUCKET_NAME must be provided for S3 exports","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/factory.py","lineNumber":54,"sourceCode":"        raise NotImplementedError(f\"Provider '{provider}' not supported for Focus export\")\n\n    @staticmethod\n    def _resolve_config(\n        *,\n        provider: str,\n        overrides: dict[str, Any],\n    ) -> dict[str, Any]:\n        if provider == \"s3\":\n            resolved = {\n                \"bucket_name\": overrides.get(\"bucket_name\") or os.getenv(\"FOCUS_S3_BUCKET_NAME\"),\n                \"region_name\": overrides.get(\"region_name\") or os.getenv(\"FOCUS_S3_REGION_NAME\"),\n                \"endpoint_url\": overrides.get(\"endpoint_url\") or os.getenv(\"FOCUS_S3_ENDPOINT_URL\"),\n                \"aws_access_key_id\": overrides.get(\"aws_access_key_id\") or os.getenv(\"FOCUS_S3_ACCESS_KEY\"),\n                \"aws_secret_access_key\": overrides.get(\"aws_secret_access_key\") or os.getenv(\"FOCUS_S3_SECRET_KEY\"),\n                \"aws_session_token\": overrides.get(\"aws_session_token\") or os.getenv(\"FOCUS_S3_SESSION_TOKEN\"),\n            }\n            if not resolved.get(\"bucket_name\"):\n                raise ValueError(\"FOCUS_S3_BUCKET_NAME must be provided for S3 exports\")\n            return {k: v for k, v in resolved.items() if v is not None}\n        if provider == \"vantage\":\n            resolved = {\n                \"api_key\": overrides.get(\"api_key\") or os.getenv(\"VANTAGE_API_KEY\"),\n                \"integration_token\": overrides.get(\"integration_token\") or os.getenv(\"VANTAGE_INTEGRATION_TOKEN\"),\n                \"base_url\": overrides.get(\"base_url\") or os.getenv(\"VANTAGE_BASE_URL\", \"https://api.vantage.sh\"),\n            }\n            if not resolved.get(\"api_key\"):\n                raise ValueError(\"VANTAGE_API_KEY must be provided for Vantage exports\")\n            if not resolved.get(\"integration_token\"):\n                raise ValueError(\"VANTAGE_INTEGRATION_TOKEN must be provided for Vantage exports\")\n            return {k: v for k, v in resolved.items() if v is not None}\n        if provider == \"gcs\":\n            resolved = {\n                \"bucket_name\": overrides.get(\"bucket_name\") or os.getenv(\"FOCUS_GCS_BUCKET_NAME\"),\n                \"service_account_json\": overrides.get(\"service_account_json\")\n                or os.getenv(\"FOCUS_GCS_PATH_SERVICE_ACCOUNT\"),\n            }","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/focus/destinations/factory.py#L36-L72","documentation":"When building an S3 Focus destination, _resolve_config fills bucket_name from config overrides first, then the FOCUS_S3_BUCKET_NAME environment variable; if neither yields a value it raises ValueError. The bucket is the one piece of config with no default or inference (credentials can come from the standard AWS chain), so it is validated eagerly at factory time, not at first upload.","triggerScenarios":"FocusDestinationFactory.create(provider='s3', ...) with no bucket_name in config and FOCUS_S3_BUCKET_NAME unset; env var set in the shell but not in the systemd/Docker service environment; a misspelled variable name (e.g. FOCUS_S3_BUCKET).","commonSituations":"Local works (env set in .bashrc), deployed worker fails (env not passed through); secrets managed per-environment and S3 region/keys set but bucket forgotten; k8s Secret not mounted into the export CronJob.","solutions":["Set FOCUS_S3_BUCKET_NAME in the environment the export runs in","Or pass bucket_name explicitly: FocusDestinationFactory.create(provider='s3', config={'bucket_name': ...})","For containers/services, ensure the env var is declared in the unit/spec, not just the interactive shell","Fail fast at startup: assert FOCUS_S3_BUCKET_NAME when S3 export is configured"],"exampleFix":"# before\ndest = FocusDestinationFactory.create(provider='s3', prefix='focus/')\n\n# after\nimport os\nos.environ.setdefault('FOCUS_S3_BUCKET_NAME', 'my-focus-bucket')\ndest = FocusDestinationFactory.create(\n    provider='s3',\n    prefix='focus/',\n    config={'bucket_name': os.environ['FOCUS_S3_BUCKET_NAME']},\n)","handlingStrategy":"validation","validationCode":"import os\n\nbucket = config.get('bucket_name') or os.getenv('FOCUS_S3_BUCKET_NAME')\nif not bucket:\n    raise ValueError('FOCUS_S3_BUCKET_NAME (or config bucket_name) required for S3 Focus export')\ndest = FocusDestinationFactory.create(provider='s3', prefix='focus/', config={'bucket_name': bucket})","typeGuard":null,"tryCatchPattern":"try:\n    dest = FocusDestinationFactory.create(provider='s3', prefix='focus/', config=config)\nexcept ValueError as e:\n    if 'FOCUS_S3_BUCKET_NAME' in str(e):\n        raise RuntimeError('S3 Focus export not configured; set FOCUS_S3_BUCKET_NAME') from e\n    raise","preventionTips":["Declare FOCUS_S3_BUCKET_NAME in the service/container spec, not just the interactive shell","Add a startup assertion for the var whenever S3 export is enabled","Keep bucket names in the same secret/config source as the AWS credentials"],"tags":["litellm","focus","s3","export","missing-env-var","aws"],"backgroundTag":"missing-env-var","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}