remotion-dev/remotion · error · error
failed to create bucket: %w
Error message
failed to create bucket: %w
What it means
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.
Source
Thrown at packages/lambda-go/s3.go:145
strings.Join(buckets, ", "), region, bucketNamePrefix,
)
}
if len(buckets) == 1 {
return buckets[0], nil
}
bucket, err := makeBucketName(region)
if err != nil {
return "", err
}
input := &s3.CreateBucketInput{Bucket: new(bucket)}
if region != regionUsEast1 {
input.CreateBucketConfiguration = &types.CreateBucketConfiguration{
LocationConstraint: types.BucketLocationConstraint(region),
}
}
if _, err := svc.CreateBucket(context.TODO(), input); err != nil {
return "", fmt.Errorf("failed to create bucket: %w", err)
}
return bucket, nil
}
// uploadInputPropsToS3 writes the serialized props to S3 as private JSON.
func uploadInputPropsToS3(svc objectUploader, bucket string, key string, payload string) error {
_, err := svc.PutObject(context.TODO(), &s3.PutObjectInput{
Bucket: new(bucket),
Key: new(key),
Body: strings.NewReader(payload),
ContentType: new("application/json"),
})
if err != nil {
return fmt.Errorf("failed to upload inputProps to S3: %w", err)
}
return nil
}
View on GitHub (pinned to 78fe4bb3fd)
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).
Defensive patterns
Strategy: try-catch
Try / catch
bucket, err := getOrCreateBucket(svc, region)
if err != nil {
var awsErr smithy.APIError
if errors.As(err, &awsErr) {
switch awsErr.ErrorCode() {
case "AccessDenied":
// grant s3:CreateBucket
case "BucketAlreadyExists":
// random-name collision: retry once
case "IllegalLocationConstraintException":
// region string invalid or equals us-east-1 in the constraint
}
}
return "", err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- could not get location of S3 bucket %q: %w
- could not list S3 buckets: %w
- you have multiple buckets (%s) in your S3 region (%s) starti
- failed to upload inputProps to S3: %w
- Failed to create bucket: {$exception->getMessage()}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/d72128f0da41b357.
Report an issue: GitHub.