remotion-dev/remotion · error · Error

Duplicate custom Layer ARN: ${layerArn}.

Error message

Duplicate custom Layer ARN: ${layerArn}.

What it means

validateCustomLayerArns tracks already-seen ARNs in a Set and throws when the same layer version ARN appears twice in customLayerArns. Duplicate entries are always a configuration error — attaching the same layer twice gains nothing and would otherwise only fail at the AWS API level.

Source

Thrown at packages/lambda/src/shared/validate-custom-layer-arns.ts:76

			throw new TypeError(
				`Invalid Lambda Layer version ARN: ${layerArn}. Expected arn:<partition>:lambda:<region>:<12-digit-account-id>:layer:<layer-name>:<numeric-version>.`,
			);
		}

		if (match[1] !== partition) {
			throw new Error(
				`The custom Layer ARN ${layerArn} uses partition ${match[1]}, but region ${region} uses partition ${partition}.`,
			);
		}

		if (match[2] !== region) {
			throw new Error(
				`The custom Layer ARN ${layerArn} is in region ${match[2]}, but the function is being deployed to ${region}.`,
			);
		}

		if (seen.has(layerArn)) {
			throw new Error(`Duplicate custom Layer ARN: ${layerArn}.`);
		}

		seen.add(layerArn);
	}
};

View on GitHub (pinned to 10db9de073)

Solutions

  1. Deduplicate before deploying: `[...new Set(customLayerArns)]`.
  2. Remove the duplicated entry from whichever config fragment contributed it twice.

Example fix

// before
await deployFunction({
  region: 'us-east-1',
  customLayerArns: [...baseLayers, ...extraLayers], // same ARN in both
});

// after
await deployFunction({
  region: 'us-east-1',
  customLayerArns: [...new Set([...baseLayers, ...extraLayers])],
});
Defensive patterns

Strategy: validation

Validate before calling

const unique = [...new Set(customLayerArns)];
if (unique.length !== customLayerArns.length) {
  console.warn('Removing duplicate layer ARNs before deploy');
}
// deploy with `unique`

Prevention

When it happens

Trigger: Passing an array like `[arnA, arnA]` to deployFunction, typically the result of concatenating layer lists (base + extra) that both contain the same ARN.

Common situations: Merging a default layer list with an environment-specific overlay without deduplication; copy-paste duplication inside large layer arrays.

Related errors


AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22). Data as JSON: /api/errors/d75df22c4cb9f1ee. Report an issue: GitHub.