{"record":{"id":"5f329994d74ebbd0","repo":"remotion-dev/remotion","slug":"invalid-runtime-preference-option-must-be-one","errorCode":null,"errorMessage":"Invalid runtime preference ${option}. Must be one of ${LambdaClientInternals.runtimePreferenceOptions.join(', ')}","messagePattern":"Invalid runtime preference (.+?)\\. Must be one of (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/get-layers.ts","lineNumber":16,"sourceCode":"import type {AwsRegion, RuntimePreference} from '@remotion/lambda-client';\nimport {LambdaClientInternals} from '@remotion/lambda-client';\nimport type {AwsLayer} from './hosted-layers';\nimport {hostedLayers} from './hosted-layers';\n\nexport const validateRuntimePreference = (option: unknown) => {\n\tif (!option) {\n\t\treturn;\n\t}\n\n\tif (\n\t\t!LambdaClientInternals.runtimePreferenceOptions.includes(\n\t\t\toption as RuntimePreference,\n\t\t)\n\t) {\n\t\tthrow new Error(\n\t\t\t`Invalid runtime preference ${option}. Must be one of ${LambdaClientInternals.runtimePreferenceOptions.join(\n\t\t\t\t', ',\n\t\t\t)}`,\n\t\t);\n\t}\n};\n\nexport const getLayers = ({\n\toption,\n\tregion,\n}: {\n\toption: RuntimePreference;\n\tregion: AwsRegion;\n}): AwsLayer[] => {\n\tconst layers = hostedLayers[region];\n\treturn layers.filter((layer) => {\n\t\tif (layer.layerArn.includes('emoji-apple')) {\n\t\t\treturn option === 'apple-emojis';","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/get-layers.ts#L1-L34","documentation":"Thrown by validateRuntimePreference(), invoked from deployFunction(), when the runtimePreference value is truthy but not one of the allowed options: 'default', 'apple-emojis', 'cjk'. The preference selects which Lambda layer set is used (e.g. Apple vs Google emoji rendering vs CJK fonts).","triggerScenarios":"Passing deployFunction({runtimePreference: 'apple-emoji'}), 'Apple', 'system', or any string/number not equal to one of the three allowed values.","commonSituations":"Misspelling 'apple-emojis' (singular, capitalised, hyphenated differently); copy-pasting an outdated option name from old docs; passing a boolean or numeric code instead of the string literal.","solutions":["Use one of the exact allowed values: 'default', 'apple-emojis', or 'cjk' (case-sensitive).","Omit runtimePreference entirely to accept the default behaviour.","Import the RuntimePreference type so TypeScript rejects invalid literals at compile time."],"exampleFix":"// before\ndeployFunction({region, runtimePreference: 'apple-emoji'})\n// after\ndeployFunction({region, runtimePreference: 'apple-emojis'})","handlingStrategy":"type-guard","validationCode":"import {runtimePreferenceOptions} from '@remotion/lambda-client'\nconst pref = process.env.RUNTIME_PREFERENCE\nif (pref && !runtimePreferenceOptions.includes(pref)) {\n  throw new Error(`runtimePreference must be one of ${runtimePreferenceOptions.join(', ')}`)\n}","typeGuard":"import {runtimePreferenceOptions, type RuntimePreference} from '@remotion/lambda-client'\nconst isRuntimePreference = (v: unknown): v is RuntimePreference =>\n  typeof v === 'string' && (runtimePreferenceOptions as readonly string[]).includes(v)","tryCatchPattern":null,"preventionTips":["Import the RuntimePreference type so invalid literals fail to compile.","Treat runtimePreference as optional; omit it unless you need a specific layer set.","Add a unit test asserting your config value is in runtimePreferenceOptions."],"tags":["validation","configuration","typescript"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}