remotion-dev/remotion · error

Output file "${key}" in bucket "${renderBucketName}" in regi

Error message

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."

What it means

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.

Source

Thrown at packages/serverless/src/handlers/launch.ts:427

			renderMetadata,
			region: insideFunctionSpecifics.getCurrentRegionInFunction(),
			currentRegion: insideFunctionSpecifics.getCurrentRegionInFunction(),
			providerSpecifics,
			forcePathStyle: params.forcePathStyle,
			requestHandler: null,
		}).catch((err) => {
			if (
				err instanceof OutputFileAccessDeniedError &&
				renderMetadata.outputFileIsConditional
			) {
				// The final conditional upload still enforces overwrite: false.
				return null;
			}

			throw err;
		});
		if (output) {
			throw new TypeError(
				`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."`,
			);
		}

		findOutputFile.end();
	}

	overallProgress.setRenderMetadata(renderMetadata);

	const artifactRegistry = makeArtifactRegistry();

	const onArtifact: OnArtifactFromRenderer = ({artifact, chunk, attempt}) => {
		const artifactRegistration = artifactRegistry.registerArtifact({
			chunk,
			frame: artifact.frame,
			attempt,
			filename: artifact.filename,
		});

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Set `overwrite: true` in renderMediaOnLambda() if overwriting the existing output is intended
  2. Delete the existing S3 object before rendering (aws s3 rm s3://bucket/key or DeleteObject)
  3. Use a unique output key (e.g. include a timestamp or render ID) instead of a fixed key
  4. Use a dedicated bucket/prefix per render run

Example fix

// before
await renderMediaOnLambda({ region: 'us-east-1', functionName: fn, serveUrl: url, composition: 'MyComp', inputProps: {}, outputKey: 'out/video.mp4' });
// after
await renderMediaOnLambda({ region: 'us-east-1', functionName: fn, serveUrl: url, composition: 'MyComp', inputProps: {}, outputKey: 'out/video.mp4', overwrite: true });
Defensive patterns

Strategy: validation

Validate before calling

// Before rendering, check key availability via the render progress or just enable overwrite
import {getRenderProgress} from '@remotion/lambda';
// simplest pre-check: use a unique key
const outputKey = `renders/${Date.now()}-video.mp4`;

Type guard

null

Try / catch

try {
  await renderMediaOnLambda({...});
} catch (e) {
  if (String((e as Error).message).includes('already exists')) {
    // delete the S3 object or set overwrite: true and retry once
  } else { throw e; }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/a185404d677a491f. Report an issue: GitHub.