{"record":{"id":"d9de7530df401f79","repo":"remotion-dev/remotion","slug":"the-nameofprop-prop-location-must-be-finit","errorCode":null,"errorMessage":"The \"${nameOfProp}\" prop ${location} must be finite, but is ${amount}.","messagePattern":"The \"(.+?)\" prop (.+?) must be finite, but is (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-dimensions.ts","lineNumber":19,"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(\n\t\t\t`The \"${nameOfProp}\" prop ${location} must be positive, but got ${amount}.`,\n\t\t);\n\t}\n}\n","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-dimensions.ts#L1-L36","documentation":"`validateDimension` rejects non-finite (i.e. `Infinity` / `-Infinity`) `width`/`height`. Infinite dimensions would create an unbounded frame buffer; the validator catches them after the NaN check.","triggerScenarios":"Setting `width`/`height` to `Infinity` or a value that evaluates to it, e.g. `1/0`, `Math.max(...[])` (returns -Infinity), or dividing by zero.","commonSituations":"Computing a dimension from an empty dataset (`Math.max`/`Math.min` of empty arrays); a scaling factor that divides by zero; a malformed calculation in `calculateMetadata`.","solutions":["Clamp computed dimensions to real bounds, e.g. `Math.min(Math.max(v, 1), 7680)`.","Use `Number.isFinite()` to reject Infinity before assigning.","Handle empty-array edge cases in min/max aggregation."],"exampleFix":"// before\nconst width = Math.max(...sizes); // sizes empty -> -Infinity\n// after\nconst width = sizes.length ? Math.max(...sizes) : 1920;","handlingStrategy":"validation","validationCode":"if (!Number.isFinite(w)) { throw new Error('width must be finite'); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use Number.isFinite() to gate computed dimensions.","Beware Math.max/Math.min on empty arrays returning ±Infinity."],"tags":["validation","composition","dimensions","infinity"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}