{"record":{"id":"e13895c9d5b1ec65","repo":"remotion-dev/remotion","slug":"customlayerarns-must-contain-at-least-one-layer-ar","errorCode":null,"errorMessage":"customLayerArns must contain at least one Layer ARN.","messagePattern":"customLayerArns must contain at least one Layer ARN\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-custom-layer-arns.ts","lineNumber":33,"sourceCode":"}: {\n\tcustomLayerArns: string[] | null;\n\tenableLambdaInsights: boolean;\n\tregion: AwsRegion;\n\truntimePreference: RuntimePreference;\n}) => {\n\tconst {partition} = LambdaClientInternals.getAwsRegionMetadata(region);\n\tif (customLayerArns === null) {\n\t\tif (partition === 'aws-cn') {\n\t\t\tthrow new Error(\n\t\t\t\t'customLayerArns must be specified when deploying to AWS China regions because Remotion-hosted Layers are not available in the aws-cn partition.',\n\t\t\t);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (!Array.isArray(customLayerArns) || customLayerArns.length === 0) {\n\t\tthrow new TypeError('customLayerArns must contain at least one Layer ARN.');\n\t}\n\n\tif (runtimePreference !== 'default') {\n\t\tthrow new Error(\n\t\t\t'customLayerArns cannot be combined with a non-default runtimePreference.',\n\t\t);\n\t}\n\n\tif (customLayerArns.length + (enableLambdaInsights ? 1 : 0) > 5) {\n\t\tthrow new Error(\n\t\t\t'Lambda functions support at most 5 Layers, including the Lambda Insights Layer.',\n\t\t);\n\t}\n\n\tconst seen = new Set<string>();\n\tfor (const layerArn of customLayerArns) {\n\t\tif (typeof layerArn !== 'string' || layerArn.length === 0) {\n\t\t\tthrow new TypeError(","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda/src/shared/validate-custom-layer-arns.ts#L15-L51","documentation":"validateCustomLayerArns throws this TypeError when customLayerArns is an array with zero entries (or not an array at all). Passing an empty list is treated as a configuration mistake: you either want Remotion-hosted layers (pass null) or you must list at least one layer version ARN.","triggerScenarios":"Calling deployFunction with `customLayerArns: []`, or with a variable that was intended to be null but was initialized as an empty array.","commonSituations":"Scripts that build the layer list dynamically and end up empty (e.g. a filter removed everything); passing `[]` as a 'use defaults' signal, which this API does not accept.","solutions":["Pass `customLayerArns: null` (or omit it) if you want Remotion-hosted layers.","Otherwise include at least one valid layer version ARN in the array."],"exampleFix":"// before\nawait deployFunction({region: 'us-east-1', customLayerArns: []});\n\n// after: hosted layers\nawait deployFunction({region: 'us-east-1', customLayerArns: null});","handlingStrategy":"validation","validationCode":"const layers = customLayerArns ?? null;\nif (layers !== null && layers.length === 0) {\n  throw new Error('customLayerArns must be null or non-empty');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat `null` as the 'use hosted layers' signal; never pass [] as a placeholder.","When building layer lists dynamically, map an empty result to null."],"tags":["validation","lambda-layers","deployfunction","typescript"],"backgroundTag":"invalid-argument-value","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"}