remotion-dev/remotion · error · TypeError
The "${nameOfProp}" prop ${location} must not be NaN, but is
Error message
The "${nameOfProp}" prop ${location} must not be NaN, but is NaN. What it means
`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.
Source
Thrown at packages/core/src/validation/validate-dimensions.ts:13
export function validateDimension(
amount: unknown,
nameOfProp: string,
location: string,
): asserts amount is number {
if (typeof amount !== 'number') {
throw new Error(
`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`,
);
}
if (isNaN(amount)) {
throw new TypeError(
`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`,
);
}
if (!Number.isFinite(amount)) {
throw new TypeError(
`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`,
);
}
if (amount % 1 !== 0) {
throw new TypeError(
`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`,
);
}
if (amount <= 0) {
throw new TypeError(View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
const width = Number(config.width); // config.width undefined -> NaN
<Composition width={width} ... />
// after
const width = Number(config.width);
<Composition width={Number.isNaN(width) ? 1920 : width} ... /> Defensive patterns
Strategy: validation
Validate before calling
if (!Number.isNaN(w)) { /* ok */ } else { throw new Error('width is NaN'); } Prevention
- Treat NaN as a bug, not a default — surface optional inputs explicitly.
- Validate with Number.isNaN() before passing computed dimensions.
When it happens
Trigger: Setting `width`/`height` to `NaN` directly, or deriving it from `Number(undefined)`, `parseInt(undefined)`, `0/0`, or `parseFloat('abc')`.
Common situations: Computing a dimension from optional config without a default: `Number(maybeUndefined)` yields NaN; parsing a missing env var; downstream of an arithmetic bug.
Related errors
- The "${nameOfProp}" prop ${location} must be a number, but y
- The "${nameOfProp}" prop ${location} must be finite, but is
- The "${nameOfProp}" prop ${location} must be an integer, but
- The "${nameOfProp}" prop ${location} must be positive, but g
- Argument passed to "${api}" for param "${param}" is ${JSON.s
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/c338b63b0b435bc8.
Report an issue: GitHub.