{"record":{"id":"2ddb75835a4e95d3","repo":"remotion-dev/remotion","slug":"maxretries-must-be-a-number-but-is-json-stringi-2ddb75","errorCode":null,"errorMessage":"maxRetries must be a number, but is ${JSON.stringify(maxRetries)}","messagePattern":"maxRetries must be a number, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-retries.ts","lineNumber":5,"sourceCode":"export function validateMaxRetries(\n\tmaxRetries: unknown,\n): asserts maxRetries is number {\n\tif (typeof maxRetries !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t'maxRetries must be a number, but is ' + JSON.stringify(maxRetries),\n\t\t);\n\t}\n\n\tif (!Number.isFinite(maxRetries)) {\n\t\tthrow new TypeError('maxRetries must be finite, but is ' + maxRetries);\n\t}\n\n\tif (Number.isNaN(maxRetries)) {\n\t\tthrow new TypeError('maxRetries is NaN');\n\t}\n\n\tif (maxRetries < 0) {\n\t\tthrow new TypeError(`maxRetries cannot be negative but is ${maxRetries}`);\n\t}\n\n\tif (maxRetries % 1 !== 0) {\n\t\tthrow new TypeError(","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/validate-retries.ts#L1-L23","documentation":"Thrown by validateMaxRetries() (a TypeError) when the maxRetries value passed to the Lambda render/still CLI flow is not a number. The function is an assertion (`asserts maxRetries is number`) used by the render and still CLI commands.","triggerScenarios":"Passing maxRetries from an env var (string), a CLI flag parsed as string, undefined, or an object into renderMediaOnLambda/renderStillOnLambda or the CLI.","commonSituations":"Reading --max-retries from a custom wrapper without Number(); config files where the value is a string; passing undefined unintentionally.","solutions":["Pass a finite non-negative integer number.","Convert env/CLI string values with Number() (and guard emptiness) before passing.","Use the TypeScript signature so the compiler enforces number."],"exampleFix":"// before\nrenderMediaOnLambda({..., maxRetries: process.env.MAX_RETRIES})\n// after\nconst maxRetries = process.env.MAX_RETRIES ? Number(process.env.MAX_RETRIES) : 1\nrenderMediaOnLambda({..., maxRetries})","handlingStrategy":"type-guard","validationCode":"if (typeof maxRetries !== 'number') {\n  throw new TypeError(`maxRetries must be a number, got ${typeof maxRetries}`)\n}","typeGuard":"const isMaxRetries = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isInteger(v) && v >= 0","tryCatchPattern":null,"preventionTips":["Parse --max-retries / env values with Number() after an emptiness check.","Type the field as number so TypeScript rejects string/undefined.","Default to a small integer (1) rather than a sentinel."],"tags":["aws","lambda","validation","typescript","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}