{"record":{"id":"d9a30b4647c8920f","repo":"remotion-dev/remotion","slug":"you-have-multiple-buckets-join-buckets-i","errorCode":null,"errorMessage":"You have multiple buckets ({', '.join(buckets)}) in your S3 region ({self.region}) starting with \"remotionlambda-\". Please see https://remotion.dev/docs/lambda/multiple-buckets.","messagePattern":"You have multiple buckets \\((.+?)\\) in your S3 region \\((.+?)\\) starting with \"remotionlambda-\"\\. Please see https://remotion\\.dev/docs/lambda/multiple-buckets\\.","errorType":"exception","errorClass":"RemotionException","httpStatus":null,"severity":"error","filePath":"packages/lambda-python/remotion_lambda/remotionclient.py","lineNumber":330,"sourceCode":"            )\n        except ClientError as e:\n            logger.debug(\n                \"Could not get bucket location for %s (possibly permission issue): %s\",\n                bucket_name,\n                e,\n            )\n            raise e\n        except ParamValidationError as e:\n            raise RemotionInvalidArgumentException(\n                f\"Invalid S3 client parameters for get_bucket_location: {e}\"\n            ) from e\n\n    def _get_or_create_bucket(self) -> str:\n        \"\"\"Get existing bucket or create a new one following JS SDK logic.\"\"\"\n        buckets = self._get_remotion_buckets()\n\n        if len(buckets) > 1:\n            raise RemotionException(\n                f\"You have multiple buckets ({', '.join(buckets)}) in your S3 region \"\n                f\"({self.region}) starting with \\\"remotionlambda-\\\". \"\n                \"Please see https://remotion.dev/docs/lambda/multiple-buckets.\"\n            )\n\n        if len(buckets) == 1:\n            return buckets[0]\n\n        bucket_name = self._make_bucket_name()\n        s3_client = self._create_s3_client()\n\n        try:\n            if self.region == REGION_US_EAST:\n                s3_client.create_bucket(Bucket=bucket_name)\n            else:\n                s3_client.create_bucket(\n                    Bucket=bucket_name,\n                    CreateBucketConfiguration={'LocationConstraint': self.region},","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-python/remotion_lambda/remotionclient.py#L312-L348","documentation":"Raised when the AWS account has more than one S3 bucket whose name starts with 'remotionlambda-' in the configured region. Remotion Lambda expects exactly one such bucket to manage renders and input props; ambiguity prevents it from choosing the correct one safely.","triggerScenarios":"Running renders after a previous deployment or test created an extra remunctionlambda- bucket; deploying Remotion Lambda across multiple stacks in the same account/region; manual bucket creation; leftover buckets from deleted CloudFormation stacks.","commonSituations":"CI runs that create buckets and never clean them up; multiple developers deploying into a shared AWS account; switching deploy versions that changed the bucket naming; cross-stack contamination.","solutions":["List the buckets: `aws s3api list-buckets --query 'Buckets[?starts_with(Name,`remotionlambda-`)]'`, then delete the obsolete ones.","Keep a single bucket per region; if you need isolation, use separate AWS accounts or regions.","Follow the guidance at https://remotion.dev/docs/lambda/multiple-buckets to consolidate.","After cleanup, retry the render; the client will reuse the single remaining bucket."],"exampleFix":"// before (multiple buckets exist)\n# aws s3 ls | grep remotionlambda-\n# remotionlambda-aaa-us-east-1\n# remotionlambda-bbb-us-east-1\n\n# after\naws s3 rb s3://remotionlambda-bbb-us-east-1 --force\n# retry render - client now finds exactly one bucket","handlingStrategy":"validation","validationCode":"def ensure_single_remotion_bucket(session, region: str) -> str:\n    s3 = session.client('s3', region_name=region)\n    buckets = [b['Name'] for b in s3.list_buckets()['Buckets']\n               if b['Name'].startswith('remotionlambda-')]\n    if len(buckets) > 1:\n        raise RuntimeError(f'Multiple buckets: {buckets}. Delete all but one.')\n    return buckets[0] if buckets else ''","typeGuard":null,"tryCatchPattern":"try:\\n    client.render_media(...)\\nexcept RemotionException as e:\\n    if 'multiple buckets' in str(e).lower():\\n        # run cleanup then retry\\n        cleanup_extra_buckets()\\n        client.render_media(...)","preventionTips":["Use one remotionlambda- bucket per region per account.","Clean up buckets created by CI after each run.","Use separate AWS accounts for isolating environments."],"tags":["python","s3","bucket","deployment","lambda","aws"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}