remotion-dev/remotion · warning · Error

`throwIfSiteExists` was passed as true, but there are alread

Error message

`throwIfSiteExists` was passed as true, but there are already files in this folder: ${files.slice(0, 5).map((f) => f.Key).join(', ')}

What it means

Thrown by deploySiteFromBundle() when the caller passes throwIfSiteExists: true (the default protect-against-overwrite guard) AND the S3 prefix for the given siteName already contains objects. Its purpose is to prevent silently clobbering a previously deployed site whose files live under `${subFolder}/` in the bucket.

Source

Thrown at packages/lambda/src/shared/deploy-site-with-bundle.ts:107

	const subFolder = getSitesKey(siteName);

	const filesPromise = providerSpecifics.listObjects({
		bucketName,
		expectedBucketOwner: accountId,
		region,
		// The `/` is important to not accidentally delete sites with the same name but containing a suffix.
		prefix: `${subFolder}/`,
		forcePathStyle,
		requestHandler,
	});
	const bundlePromise = getBundle();
	const [files, bundleDir] = await waitForPromisesToFinish([
		filesPromise,
		bundlePromise,
	] as const);

	if (throwIfSiteExists && files.length > 0) {
		throw new Error(
			'`throwIfSiteExists` was passed as true, but there are already files in this folder: ' +
				files
					.slice(0, 5)
					.map((f) => f.Key)
					.join(', '),
		);
	}

	options.onDiffingProgress?.(0, false);

	let totalBytes = 0;

	const {toDelete, toUpload, existingCount} = await getS3DiffOperations({
		objects: files,
		bundle: bundleDir,
		prefix: subFolder,
		onProgress: (bytes) => {
			totalBytes = bytes;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pick a different siteName for the new deploy so it lands in its own prefix.
  2. Intentionally overwrite by passing throwIfSiteExists: false (or the matching options flag) once you confirm the old files are disposable.
  3. Delete the existing site objects under the prefix first (`npx remotion lambda sites rm` / `aws s3 rm`) and re-deploy.

Example fix

// before
deploySiteFromBundle({bucketName, region, bundleDir, siteName: 'my-video'})
// after - opt into overwrite
deploySiteFromBundle({bucketName, region, bundleDir, siteName: 'my-video', options: {throwIfSiteExists: false}})
Defensive patterns

Strategy: validation

Validate before calling

// Decide policy before deploy: never overwrite unless explicitly intended
const options = {throwIfSiteExists: process.env.OVERWRITE_SITE === '1' ? false : true}
deploySiteFromBundle({bucketName, region, bundleDir, siteName, options})

Try / catch

try {
  await deploySiteFromBundle({bucketName, region, bundleDir, siteName})
} catch (e) {
  if (/throwIfSiteExists/.test(e.message)) {
    // either pick a new siteName or confirm overwrite and set throwIfSiteExists:false
  } else throw e
}

Prevention

When it happens

Trigger: Re-running deploySiteFromBundle with the same siteName and the default throwIfSiteExists=true after a prior deploy. Listing the prefix via providerSpecifics.listObjects returns one or more objects.

Common situations: Iterating on a deploy and reusing the same siteName; CI re-running a deploy job against an existing site; deploying a second project that collides with the first site's name.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/7c911723bf71dbdb. Report an issue: GitHub.