remotion-dev/remotion · error · TypeError
'${codec}' is not a valid codec for Lambda. The following va
Error message
'${codec}' is not a valid codec for Lambda. The following values are supported: ${serverlessCodecs.join(', ')} What it means
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.
Source
Thrown at packages/lambda-client/src/validate-lambda-codec.ts:11
/* eslint-disable no-console */
import type {ServerlessCodec} from '@remotion/serverless-client';
import {serverlessCodecs} from '@remotion/serverless-client';
export const validateLambdaCodec = (codec: unknown): ServerlessCodec => {
if (typeof codec !== 'string') {
throw new TypeError('"codec" must be a string ');
}
if (!(serverlessCodecs as readonly string[]).includes(codec)) {
throw new TypeError(
"'" +
codec +
"' is not a valid codec for Lambda. The following values are supported: " +
serverlessCodecs.join(', '),
);
}
if ((codec as string) === 'h264-mkv') {
console.warn(
'The "h264-mkv" codec for renderMediaOnLambda() is deprecated - it\'s now just "h264".',
);
return 'h264';
}
return codec as ServerlessCodec;
};
View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
renderMediaOnLambda({ composition: 'Main', codec: 'H264' }); // wrong case
// after
renderMediaOnLambda({ composition: 'Main', codec: 'h264' }); Defensive patterns
Strategy: type-guard
Validate before calling
import { serverlessCodecs } from '@remotion/serverless-client';
if (!(serverlessCodecs as readonly string[]).includes(codec)) {
throw new TypeError(`Unsupported codec: ${codec}. Supported: ${serverlessCodecs.join(', ')}`);
} Type guard
import { serverlessCodecs } from '@remotion/serverless-client';
import type { ServerlessCodec } from '@remotion/serverless-client';
const isServerlessCodec = (c: unknown): c is ServerlessCodec =>
typeof c === 'string' && (serverlessCodecs as readonly string[]).includes(c); Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Memory size must be a positive integer. Received: ${memorySi
- Disk size must be a positive integer. Received: ${diskSizeIn
- Timeout must be a positive integer. Received: ${timeoutInSec
- The browser threw an error while playing the video ${props.s
- Lambda Insights is not supported by AWS in region ${region}.
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/a64471c220097b90.
Report an issue: GitHub.