{"record":{"id":"a64471c220097b90","repo":"remotion-dev/remotion","slug":"codec-is-not-a-valid-codec-for-lambda-the-fo","errorCode":null,"errorMessage":"'${codec}' is not a valid codec for Lambda. The following values are supported: ${serverlessCodecs.join(', ')}","messagePattern":"'(.+?)' is not a valid codec for Lambda\\. The following values are supported: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-lambda-codec.ts","lineNumber":11,"sourceCode":"/* eslint-disable no-console */\nimport type {ServerlessCodec} from '@remotion/serverless-client';\nimport {serverlessCodecs} from '@remotion/serverless-client';\n\nexport const validateLambdaCodec = (codec: unknown): ServerlessCodec => {\n\tif (typeof codec !== 'string') {\n\t\tthrow new TypeError('\"codec\" must be a string ');\n\t}\n\n\tif (!(serverlessCodecs as readonly string[]).includes(codec)) {\n\t\tthrow new TypeError(\n\t\t\t\"'\" +\n\t\t\t\tcodec +\n\t\t\t\t\"' is not a valid codec for Lambda. The following values are supported: \" +\n\t\t\t\tserverlessCodecs.join(', '),\n\t\t);\n\t}\n\n\tif ((codec as string) === 'h264-mkv') {\n\t\tconsole.warn(\n\t\t\t'The \"h264-mkv\" codec for renderMediaOnLambda() is deprecated - it\\'s now just \"h264\".',\n\t\t);\n\n\t\treturn 'h264';\n\t}\n\n\treturn codec as ServerlessCodec;\n};\n","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-lambda-codec.ts#L1-L29","documentation":"Second guard in validateLambdaCodec: the codec string must be one of the values in serverlessCodecs (exported from @remotion/serverless-client). An unrecognized codec name throws a TypeError listing every supported codec. The check is case- and spelling-sensitive.","triggerScenarios":"Calling validateLambdaCodec with a string that is not in the serverlessCodecs array (e.g., 'H264' with wrong case, 'x264', 'mov', 'webm', 'prores' if unsupported on Lambda).","commonSituations":"Using a codec valid for local renderMedia() but not for Lambda (the Lambda set is smaller); typo or wrong casing in the codec string; passing a container format instead of a codec; version mismatch where the codec was renamed/removed.","solutions":["Use one of the codecs listed in the error message (e.g., 'h264', 'h265', 'vp8', 'vp9', 'mp3', 'aac', 'wav', 'gif').","Match the exact casing shown in the list.","If you need a codec not in the list, render locally with renderMedia() instead of on Lambda."],"exampleFix":"// before\nrenderMediaOnLambda({ composition: 'Main', codec: 'H264' }); // wrong case\n\n// after\nrenderMediaOnLambda({ composition: 'Main', codec: 'h264' });","handlingStrategy":"type-guard","validationCode":"import { serverlessCodecs } from '@remotion/serverless-client';\nif (!(serverlessCodecs as readonly string[]).includes(codec)) {\n  throw new TypeError(`Unsupported codec: ${codec}. Supported: ${serverlessCodecs.join(', ')}`);\n}","typeGuard":"import { serverlessCodecs } from '@remotion/serverless-client';\nimport type { ServerlessCodec } from '@remotion/serverless-client';\nconst isServerlessCodec = (c: unknown): c is ServerlessCodec =>\n  typeof c === 'string' && (serverlessCodecs as readonly string[]).includes(c);","tryCatchPattern":null,"preventionTips":["Source the codec list from serverlessCodecs, not a hardcoded array.","Use a dropdown of supported codecs in your UI.","Match exact casing from the list."],"tags":["input-validation","codec","lambda","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}