{"record":{"id":"a185404d677a491f","repo":"remotion-dev/remotion","slug":"output-file-key-in-bucket-renderbucketname","errorCode":null,"errorMessage":"Output file \"${key}\" in bucket \"${renderBucketName}\" in region \"${insideFunctionSpecifics.getCurrentRegionInFunction()}\" already exists. Delete it before re-rendering, or set the 'overwrite' option in renderMediaOnLambda() to overwrite it.\"","messagePattern":"Output file \"(.+?)\" in bucket \"(.+?)\" in region \"(.+?)\" already exists\\. Delete it before re-rendering, or set the 'overwrite' option in renderMediaOnLambda\\(\\) to overwrite it\\.\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/serverless/src/handlers/launch.ts","lineNumber":427,"sourceCode":"\t\t\trenderMetadata,\n\t\t\tregion: insideFunctionSpecifics.getCurrentRegionInFunction(),\n\t\t\tcurrentRegion: insideFunctionSpecifics.getCurrentRegionInFunction(),\n\t\t\tproviderSpecifics,\n\t\t\tforcePathStyle: params.forcePathStyle,\n\t\t\trequestHandler: null,\n\t\t}).catch((err) => {\n\t\t\tif (\n\t\t\t\terr instanceof OutputFileAccessDeniedError &&\n\t\t\t\trenderMetadata.outputFileIsConditional\n\t\t\t) {\n\t\t\t\t// The final conditional upload still enforces overwrite: false.\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tthrow err;\n\t\t});\n\t\tif (output) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Output file \"${key}\" in bucket \"${renderBucketName}\" in region \"${insideFunctionSpecifics.getCurrentRegionInFunction()}\" already exists. Delete it before re-rendering, or set the 'overwrite' option in renderMediaOnLambda() to overwrite it.\"`,\n\t\t\t);\n\t\t}\n\n\t\tfindOutputFile.end();\n\t}\n\n\toverallProgress.setRenderMetadata(renderMetadata);\n\n\tconst artifactRegistry = makeArtifactRegistry();\n\n\tconst onArtifact: OnArtifactFromRenderer = ({artifact, chunk, attempt}) => {\n\t\tconst artifactRegistration = artifactRegistry.registerArtifact({\n\t\t\tchunk,\n\t\t\tframe: artifact.frame,\n\t\t\tattempt,\n\t\t\tfilename: artifact.filename,\n\t\t});","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/serverless/src/handlers/launch.ts#L409-L445","documentation":"Remotion Lambda throws this when the S3 output file for the render already exists in the target bucket and the `overwrite` option was not enabled in renderMediaOnLambda(). The guard exists so a re-render never silently clobbers a previously produced video.","triggerScenarios":"Calling renderMediaOnLambda() (via innerLaunchHandler in the Lambda launch routine) with the same output key into a bucket that already contains that key, while `overwrite` is not set.","commonSituations":"Re-running a render with an explicit outputKey/filename that was used before; CI pipelines that reuse deterministic keys; renders after a failed/partial prior run where cleanup didn't happen; local codegen that doesn't compute unique keys.","solutions":["Set `overwrite: true` in renderMediaOnLambda() if overwriting the existing output is intended","Delete the existing S3 object before rendering (aws s3 rm s3://bucket/key or DeleteObject)","Use a unique output key (e.g. include a timestamp or render ID) instead of a fixed key","Use a dedicated bucket/prefix per render run"],"exampleFix":"// before\nawait renderMediaOnLambda({ region: 'us-east-1', functionName: fn, serveUrl: url, composition: 'MyComp', inputProps: {}, outputKey: 'out/video.mp4' });\n// after\nawait renderMediaOnLambda({ region: 'us-east-1', functionName: fn, serveUrl: url, composition: 'MyComp', inputProps: {}, outputKey: 'out/video.mp4', overwrite: true });","handlingStrategy":"validation","validationCode":"// Before rendering, check key availability via the render progress or just enable overwrite\nimport {getRenderProgress} from '@remotion/lambda';\n// simplest pre-check: use a unique key\nconst outputKey = `renders/${Date.now()}-video.mp4`;","typeGuard":"null","tryCatchPattern":"try {\n  await renderMediaOnLambda({...});\n} catch (e) {\n  if (String((e as Error).message).includes('already exists')) {\n    // delete the S3 object or set overwrite: true and retry once\n  } else { throw e; }\n}","preventionTips":["Always set overwrite: true when re-rendering to fixed keys is intended","Generate unique output keys per render (timestamp or render ID)","Clean up old render outputs from the bucket on a schedule"],"tags":["aws","lambda","s3","storage","conflict"],"backgroundTag":"file-already-exists","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}