{"record":{"id":"bb029a2591a14ca5","repo":"zylon-ai/private-gpt","slug":"s3-storage-provider-requires-bucket-name","errorCode":null,"errorMessage":"S3 storage provider requires bucket_name","messagePattern":"S3 storage provider requires bucket_name","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/storage/storage_component.py","lineNumber":46,"sourceCode":"        bucket_name: str | None = None,\n    ) -> ObjectStorage:\n        key = f\"{provider}:{local_root_path}:{bucket_name}\"\n        with self._lock:\n            storage = self._storages.get(key)\n            if storage is not None:\n                return storage\n\n            match provider:\n                case \"local\":\n                    if local_root_path is None:\n                        raise ValueError(\n                            \"Local storage provider requires local_root_path\"\n                        )\n\n                    storage = LocalObjectStorage(root_path=local_root_path)\n                case \"s3\":\n                    if bucket_name is None:\n                        raise ValueError(\"S3 storage provider requires bucket_name\")\n                    storage = S3ObjectStorage(\n                        s3_helper=self._injector.get(S3Helper),\n                        bucket_name=bucket_name,\n                    )\n                case _:\n                    raise ValueError(f\"Unsupported storage provider: {provider}\")\n\n            self._storages[key] = storage\n            return storage\n","sourceCodeStart":28,"sourceCodeEnd":56,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/storage/storage_component.py#L28-L56","documentation":"Raised by StorageComponent when provider=\"s3\" is selected but bucket_name is None. The S3ObjectStorage constructor needs a concrete bucket to operate on, so the factory refuses to build an instance without one. This is a pure configuration error raised before any AWS call is made.","triggerScenarios":"Calling the storage factory with provider=\"s3\" and omitting bucket_name. Common when the S3 bucket setting is absent from settings.yaml or the environment while the provider is set to s3.","commonSituations":"Migrating from local to S3 storage without adding the bucket setting; per-environment configs where the bucket name is only defined in prod; typos in the settings key name.","solutions":["Add the bucket name to configuration (e.g. storage: bucket_name: my-ingestion-bucket)","If calling the factory directly, pass bucket_name explicitly","Verify the settings key spelling matches what the component reads, and add a startup check that provider-specific fields are set"],"exampleFix":"# before\nstorage = storage_component.get_storage(provider=\"s3\")\n# after\nstorage = storage_component.get_storage(\n    provider=\"s3\",\n    bucket_name=settings.storage.bucket_name,\n)","handlingStrategy":"validation","validationCode":"def validate_s3_storage(sc, bucket_name: str | None) -> None:\n    if bucket_name is None:\n        raise ValueError(\"configure storage.bucket_name before provider=s3\")\n    sc.get_storage(provider=\"s3\", bucket_name=bucket_name)","typeGuard":"def is_s3_storage_ready(provider: str, bucket_name: str | None) -> bool:\n    return provider != \"s3\" or bucket_name is not None","tryCatchPattern":null,"preventionTips":["Assert provider-specific config in a startup health check","Keep per-environment settings files complete (provider + its required field)"],"tags":["storage","s3","configuration","validation"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}