{"record":{"id":"d75df22c4cb9f1ee","repo":"remotion-dev/remotion","slug":"duplicate-custom-layer-arn-layerarn","errorCode":null,"errorMessage":"Duplicate custom Layer ARN: ${layerArn}.","messagePattern":"Duplicate custom Layer ARN: (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-custom-layer-arns.ts","lineNumber":76,"sourceCode":"\t\t\tthrow new TypeError(\n\t\t\t\t`Invalid Lambda Layer version ARN: ${layerArn}. Expected arn:<partition>:lambda:<region>:<12-digit-account-id>:layer:<layer-name>:<numeric-version>.`,\n\t\t\t);\n\t\t}\n\n\t\tif (match[1] !== partition) {\n\t\t\tthrow new Error(\n\t\t\t\t`The custom Layer ARN ${layerArn} uses partition ${match[1]}, but region ${region} uses partition ${partition}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (match[2] !== region) {\n\t\t\tthrow new Error(\n\t\t\t\t`The custom Layer ARN ${layerArn} is in region ${match[2]}, but the function is being deployed to ${region}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (seen.has(layerArn)) {\n\t\t\tthrow new Error(`Duplicate custom Layer ARN: ${layerArn}.`);\n\t\t}\n\n\t\tseen.add(layerArn);\n\t}\n};\n","sourceCodeStart":58,"sourceCodeEnd":82,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda/src/shared/validate-custom-layer-arns.ts#L58-L82","documentation":"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.","triggerScenarios":"Passing an array like `[arnA, arnA]` to deployFunction, typically the result of concatenating layer lists (base + extra) that both contain the same ARN.","commonSituations":"Merging a default layer list with an environment-specific overlay without deduplication; copy-paste duplication inside large layer arrays.","solutions":["Deduplicate before deploying: `[...new Set(customLayerArns)]`.","Remove the duplicated entry from whichever config fragment contributed it twice."],"exampleFix":"// before\nawait deployFunction({\n  region: 'us-east-1',\n  customLayerArns: [...baseLayers, ...extraLayers], // same ARN in both\n});\n\n// after\nawait deployFunction({\n  region: 'us-east-1',\n  customLayerArns: [...new Set([...baseLayers, ...extraLayers])],\n});","handlingStrategy":"validation","validationCode":"const unique = [...new Set(customLayerArns)];\nif (unique.length !== customLayerArns.length) {\n  console.warn('Removing duplicate layer ARNs before deploy');\n}\n// deploy with `unique`","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate whenever layer lists are merged from multiple config sources.","Generate layer lists from a Set or map keyed by ARN so duplicates cannot appear."],"tags":["aws","arn","lambda-layers","validation"],"backgroundTag":"duplicate-arn","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}