{"record":{"id":"1c6b6bd9224c5e37","repo":"remotion-dev/remotion","slug":"bucket-creation-is-required-but-no-region-has-bee","errorCode":null,"errorMessage":"Bucket creation is required, but no region has been passed.","messagePattern":"Bucket creation is required, but no region has been passed\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cloudrun/src/api/get-or-create-bucket.ts","lineNumber":63,"sourceCode":"\t\t\talreadyExisted: true,\n\t\t};\n\t}\n\n\tif (params?.region) {\n\t\tparams.updateBucketState?.('Creating bucket');\n\n\t\tconst bucketName = makeBucketName();\n\t\tawait createBucket({\n\t\t\tbucketName,\n\t\t\tregion: params.region,\n\t\t});\n\n\t\tparams.updateBucketState?.('Created bucket');\n\n\t\treturn {bucketName, alreadyExisted: false};\n\t}\n\n\tthrow new Error(\n\t\t'Bucket creation is required, but no region has been passed.',\n\t);\n};\n","sourceCodeStart":45,"sourceCodeEnd":67,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/api/get-or-create-bucket.ts#L45-L67","documentation":"Thrown by getOrCreateBucket() when the function reaches the end of its control flow without having an existing bucket or sufficient parameters to create one. The code returns an existing bucket if remotionBuckets.length === 1, otherwise it attempts creation which requires params.region. If neither path executes, the final throw is reached.","triggerScenarios":"Calling getOrCreateBucket with params where region is undefined/null/empty, and no pre-existing remotion bucket is found in that region, so the creation branch runs createBucket without a valid region or falls through to the final throw.","commonSituations":"Passing an object missing the region field, or passing region: undefined due to an env var not being set. The GetOrCreateBucketInput type requires region, so this typically means a caller bypassed type checks or a prior step failed to validate.","solutions":["Ensure params.region is a valid GcpRegion before calling getOrCreateBucket.","Run validateRegion(params.region) at the caller before invoking this API.","Check that any environment variable sourcing the region is set and non-empty."],"exampleFix":"// before\nawait getOrCreateBucket({region: undefined});\n// after\nimport {validateRegion} from '@remotion/cloudrun';\nawait getOrCreateBucket({region: validateRegion(process.env.GCP_REGION)});","handlingStrategy":"validation","validationCode":"if (!params?.region) {\n  throw new Error('region is required for getOrCreateBucket');\n}\nconst validated = validateRegion(params.region);\nawait getOrCreateBucket({region: validated});","typeGuard":"const hasRegion = (p): p is {region: string} =>\n  typeof p?.region === 'string' && p.region.length > 0;","tryCatchPattern":null,"preventionTips":["Always validate region with validateRegion() before any Cloud Run API call.","Centralize GCP region configuration in a single validated config object."],"tags":["cloudrun","gcp","region","validation","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}