{"record":{"id":"b1a15a5cc56d8d9c","repo":"remotion-dev/remotion","slug":"customlayerarns-cannot-be-combined-with-a-non-defa","errorCode":null,"errorMessage":"customLayerArns cannot be combined with a non-default runtimePreference.","messagePattern":"customLayerArns cannot be combined with a non-default runtimePreference\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-custom-layer-arns.ts","lineNumber":37,"sourceCode":"\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(\n\t\t\t\t'Each customLayerArns entry must be a non-empty string.',\n\t\t\t);\n\t\t}\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda/src/shared/validate-custom-layer-arns.ts#L19-L55","documentation":"validateCustomLayerArns throws when customLayerArns is combined with a runtimePreference other than 'default'. Runtime preferences like 'system-runtime' select a specific Remotion-hosted layer set, which is mutually exclusive with bringing your own layers; the deploy options cannot both take effect.","triggerScenarios":"Calling deployFunction with `customLayerArns: [...]` and `runtimePreference: 'system-runtime'` (or any non-default value).","commonSituations":"Copying a China-region style config (custom layers) into a script that also set a runtimePreference from an earlier experiment; upgrading @remotion/lambda and keeping stale runtimePreference settings in deploy config.","solutions":["Set `runtimePreference: 'default'` when supplying customLayerArns.","Or drop customLayerArns and keep the non-default runtimePreference to use Remotion-hosted layers."],"exampleFix":"// before\nawait deployFunction({\n  region: 'us-east-1',\n  runtimePreference: 'system-runtime',\n  customLayerArns: ['arn:aws:lambda:us-east-1:123456789012:layer:my-chromium:1'],\n});\n\n// after\nawait deployFunction({\n  region: 'us-east-1',\n  runtimePreference: 'default',\n  customLayerArns: ['arn:aws:lambda:us-east-1:123456789012:layer:my-chromium:1'],\n});","handlingStrategy":"validation","validationCode":"if (customLayerArns && runtimePreference !== 'default') {\n  throw new Error('customLayerArns and non-default runtimePreference are mutually exclusive');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one deploy-config source of truth and assert option combinations before deployFunction.","Remove stale runtimePreference settings when introducing custom layers."],"tags":["validation","lambda-layers","runtime-preference","deployfunction"],"backgroundTag":"conflicting-options","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"}