{"record":{"id":"6456fae2450d784d","repo":"remotion-dev/remotion","slug":"the-nameofprop-prop-location-must-be-a-num","errorCode":null,"errorMessage":"The \"${nameOfProp}\" prop ${location} must be a number, but you passed a value of type ${typeof amount}","messagePattern":"The \"(.+?)\" prop (.+?) must be a number, but you passed a value of type (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-dimensions.ts","lineNumber":7,"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(","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-dimensions.ts#L1-L25","documentation":"`validateDimension` checks the `width`/`height` of a composition (whether declared on `<Composition>` or returned from `calculateMetadata`). The first check requires a `number` type; any non-number — including `undefined` (which happens when neither the prop nor calculated metadata supplies a dimension) — throws.","triggerScenarios":"Setting `width`/`height` to a string (`'1920'`), or leaving both the `<Composition>` prop and the `calculateMetadata` return value unset so that `undefined` reaches the validator.","commonSituations":"Reading dimensions from URL params, env vars, or a JSON config as strings without coercing; forgetting width/height on a composition that relies on `calculateMetadata` which fails to return them; SSR where metadata resolution returns nothing.","solutions":["Provide numeric `width`/`height` on `<Composition>`, or ensure `calculateMetadata` returns them.","Coerce string sources: `Number(config.width)`.","Never rely on implicit conversion — strings are not accepted."],"exampleFix":"// before\n<Composition width=\"1920\" height=\"1080\" ... />\n// after\n<Composition width={1920} height={1080} ... />","handlingStrategy":"type-guard","validationCode":"if (typeof w !== 'number') {\n  throw new Error('width must be a number, got ' + typeof w);\n}","typeGuard":"const isDimension = (v) => typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":null,"preventionTips":["Always pass numeric literals for width/height.","Coerce config/env dimensions with Number() and validate.","Ensure calculateMetadata always returns width and height."],"tags":["validation","composition","dimensions","type","calculate-metadata"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}