remotion-dev/remotion · error · TypeError
Each customLayerArns entry must be a non-empty string.
Error message
Each customLayerArns entry must be a non-empty string.
What it means
validateCustomLayerArns iterates over every entry of customLayerArns and throws this TypeError when an entry is not a string or is an empty string. It is a shape check that runs before the ARN regex validation, so garbage entries (null, undefined, numbers, '') fail here rather than producing a confusing invalid-ARN message.
Source
Thrown at packages/lambda/src/shared/validate-custom-layer-arns.ts:51
throw new TypeError('customLayerArns must contain at least one Layer ARN.');
}
if (runtimePreference !== 'default') {
throw new Error(
'customLayerArns cannot be combined with a non-default runtimePreference.',
);
}
if (customLayerArns.length + (enableLambdaInsights ? 1 : 0) > 5) {
throw new Error(
'Lambda functions support at most 5 Layers, including the Lambda Insights Layer.',
);
}
const seen = new Set<string>();
for (const layerArn of customLayerArns) {
if (typeof layerArn !== 'string' || layerArn.length === 0) {
throw new TypeError(
'Each customLayerArns entry must be a non-empty string.',
);
}
const match = layerArn.match(layerVersionArnRegex);
if (!match) {
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) {View on GitHub (pinned to 10db9de073)
Solutions
- Inspect each entry and remove/fix non-string or empty values.
- Filter undefined values at the source, e.g. `.filter((arn): arn is string => typeof arn === 'string' && arn.length > 0)`.
- Set the missing environment variable that was supposed to hold the ARN.
Example fix
// before
const customLayerArns = [process.env.LAYER_ARN_1, process.env.LAYER_ARN_2]; // may contain undefined
await deployFunction({region: 'us-east-1', customLayerArns});
// after
const customLayerArns = [process.env.LAYER_ARN_1, process.env.LAYER_ARN_2]
.filter((arn): arn is string => typeof arn === 'string' && arn.length > 0);
await deployFunction({region: 'us-east-1', customLayerArns: customLayerArns.length ? customLayerArns : null}); Defensive patterns
Strategy: validation
Validate before calling
const sane = customLayerArns.every((a) => typeof a === 'string' && a.length > 0);
if (!sane) throw new Error('customLayerArns contains empty/non-string entries'); Type guard
const isNonEmptyStringArray = (v: unknown): v is string[] => Array.isArray(v) && v.every((x) => typeof x === 'string' && x.length > 0);
Prevention
- Filter env-derived arrays: `.filter((a): a is string => !!a)`.
- Fail fast on missing env vars that feed layer lists instead of letting undefined through.
When it happens
Trigger: Calling deployFunction with customLayerArns containing e.g. `undefined` (sparse config object values), `null`, a number, or `''`.
Common situations: Building the layer list from environment variables or config files where one entry is missing (`process.env.MY_LAYER_ARN` undefined); trailing empty string after a bad split/trim.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- customLayerArns must contain at least one Layer ARN.
- inputRange must contain only numbers
- outputStyles must contain only objects
- Argument passed to "${api}" for param "${param}" is undefine
- setImageSequence accepts a Boolean Value
AI-assisted analysis of remotion-dev/remotion@10db9de073 (2026-08-22).
Data as JSON: /api/errors/02036012bb6fd526.
Report an issue: GitHub.