{"record":{"id":"c338b63b0b435bc8","repo":"remotion-dev/remotion","slug":"the-nameofprop-prop-location-must-not-be-n","errorCode":null,"errorMessage":"The \"${nameOfProp}\" prop ${location} must not be NaN, but is NaN.","messagePattern":"The \"(.+?)\" prop (.+?) must not be NaN, but is NaN\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-dimensions.ts","lineNumber":13,"sourceCode":"export function validateDimension(\n\tamount: unknown,\n\tnameOfProp: string,\n\tlocation: string,\n): asserts amount is number {\n\tif (typeof amount !== 'number') {\n\t\tthrow new Error(\n\t\t\t`The \"${nameOfProp}\" prop ${location} must be a number, but you passed a value of type ${typeof amount}`,\n\t\t);\n\t}\n\n\tif (isNaN(amount)) {\n\t\tthrow new TypeError(\n\t\t\t`The \"${nameOfProp}\" prop ${location} must not be NaN, but is NaN.`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(amount)) {\n\t\tthrow new TypeError(\n\t\t\t`The \"${nameOfProp}\" prop ${location} must be finite, but is ${amount}.`,\n\t\t);\n\t}\n\n\tif (amount % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`The \"${nameOfProp}\" prop ${location} must be an integer, but is ${amount}.`,\n\t\t);\n\t}\n\n\tif (amount <= 0) {\n\t\tthrow new TypeError(","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-dimensions.ts#L1-L31","documentation":"`validateDimension` rejects `NaN` for `width`/`height`. NaN arises from failed numeric parsing or undefined arithmetic and would otherwise propagate silently into a broken render. The check fires after the type check, so it only applies to actual numbers.","triggerScenarios":"Setting `width`/`height` to `NaN` directly, or deriving it from `Number(undefined)`, `parseInt(undefined)`, `0/0`, or `parseFloat('abc')`.","commonSituations":"Computing a dimension from optional config without a default: `Number(maybeUndefined)` yields NaN; parsing a missing env var; downstream of an arithmetic bug.","solutions":["Guard optional inputs with a default before parsing: `Number(x ?? 1920)`.","Use `Number.isNaN()` to detect and fall back to a sane default.","Avoid `parseInt` on possibly-undefined values."],"exampleFix":"// before\nconst width = Number(config.width); // config.width undefined -> NaN\n<Composition width={width} ... />\n// after\nconst width = Number(config.width);\n<Composition width={Number.isNaN(width) ? 1920 : width} ... />","handlingStrategy":"validation","validationCode":"if (!Number.isNaN(w)) { /* ok */ } else { throw new Error('width is NaN'); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat NaN as a bug, not a default — surface optional inputs explicitly.","Validate with Number.isNaN() before passing computed dimensions."],"tags":["validation","composition","dimensions","nan"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}