{"record":{"id":"d72128f0da41b357","repo":"remotion-dev/remotion","slug":"failed-to-create-bucket-w","errorCode":null,"errorMessage":"failed to create bucket: %w","messagePattern":"failed to create bucket: %w","errorType":"exception","errorClass":"error","httpStatus":null,"severity":"error","filePath":"packages/lambda-go/s3.go","lineNumber":145,"sourceCode":"\t\t\tstrings.Join(buckets, \", \"), region, bucketNamePrefix,\n\t\t)\n\t}\n\tif len(buckets) == 1 {\n\t\treturn buckets[0], nil\n\t}\n\n\tbucket, err := makeBucketName(region)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tinput := &s3.CreateBucketInput{Bucket: new(bucket)}\n\tif region != regionUsEast1 {\n\t\tinput.CreateBucketConfiguration = &types.CreateBucketConfiguration{\n\t\t\tLocationConstraint: types.BucketLocationConstraint(region),\n\t\t}\n\t}\n\tif _, err := svc.CreateBucket(context.TODO(), input); err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to create bucket: %w\", err)\n\t}\n\treturn bucket, nil\n}\n\n// uploadInputPropsToS3 writes the serialized props to S3 as private JSON.\nfunc uploadInputPropsToS3(svc objectUploader, bucket string, key string, payload string) error {\n\t_, err := svc.PutObject(context.TODO(), &s3.PutObjectInput{\n\t\tBucket:      new(bucket),\n\t\tKey:         new(key),\n\t\tBody:        strings.NewReader(payload),\n\t\tContentType: new(\"application/json\"),\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to upload inputProps to S3: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-go/s3.go#L127-L163","documentation":"Returned by getOrCreateBucket when svc.CreateBucket fails while trying to provision a new Remotion bucket. The wrap carries the underlying S3 error. The create path includes the special-case for us-east-1 (no LocationConstraint), so a region mismatch between the client and the bucket constraint is a frequent culprit, as is a missing s3:CreateBucket permission.","triggerScenarios":"svc.CreateBucket returns BucketAlreadyExists (random-hash collision, extremely rare), AccessDenied (no s3:CreateBucket), IllegalLocationConstraintException (region passed to LocationConstraint is invalid or equals us-east-1), or a transport error.","commonSituations":"Production IAM roles that intentionally forbid bucket creation. Deploying into a brand-new region string the SDK does not accept. A stale AWS_REGION pointing at a different region than the LocationConstraint the code derived from it.","solutions":["Inspect the wrapped smithy.APIError code: AccessDenied → grant s3:CreateBucket; IllegalLocationConstraintException → check region string; BucketAlreadyExists → retry (random hash collision is astronomically unlikely but a re-run regenerates the name).","Pre-create the `remotionlambda-` bucket manually and let the client discover it instead of creating.","Confirm region is a valid AWS region identifier (e.g. `us-east-1`, not `us-east1`).","Ensure the caller's account is not over its bucket limit (soft limit 100)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"bucket, err := getOrCreateBucket(svc, region)\nif err != nil {\n    var awsErr smithy.APIError\n    if errors.As(err, &awsErr) {\n        switch awsErr.ErrorCode() {\n        case \"AccessDenied\":\n            // grant s3:CreateBucket\n        case \"BucketAlreadyExists\":\n            // random-name collision: retry once\n        case \"IllegalLocationConstraintException\":\n            // region string invalid or equals us-east-1 in the constraint\n        }\n    }\n    return \"\", err\n}","preventionTips":["Validate the region string against the known AWS regions before calling render.","Pre-create the bucket if creation permission is intentionally withheld.","Grant s3:CreateBucket only to the deploy role, not the runtime role."],"tags":["aws","s3","bucket","iam","region","go","lambda-go"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}