{"record":{"id":"a38139f251780dde","repo":"remotion-dev/remotion","slug":"the-frame-prop-of-freeze-must-be-a-real-numb","errorCode":null,"errorMessage":"The 'frame' prop of <Freeze /> must be a real number, but it is NaN.","messagePattern":"The 'frame' prop of <Freeze /> must be a real number, but it is NaN\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/freeze.tsx","lineNumber":41,"sourceCode":"\tactive = true,\n}) => {\n\tconst frame = useCurrentFrame();\n\tconst videoConfig = useVideoConfig();\n\n\tif (typeof frameToFreeze === 'undefined') {\n\t\tthrow new Error(\n\t\t\t`The <Freeze /> component requires a 'frame' prop, but none was passed.`,\n\t\t);\n\t}\n\n\tif (typeof frameToFreeze !== 'number') {\n\t\tthrow new Error(\n\t\t\t`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof frameToFreeze}`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(frameToFreeze)) {\n\t\tthrow new Error(\n\t\t\t`The 'frame' prop of <Freeze /> must be a real number, but it is NaN.`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(frameToFreeze)) {\n\t\tthrow new Error(\n\t\t\t`The 'frame' prop of <Freeze /> must be a finite number, but it is ${frameToFreeze}.`,\n\t\t);\n\t}\n\n\tconst isActive = useMemo(() => {\n\t\tif (typeof active === 'boolean') {\n\t\t\treturn active;\n\t\t}\n\n\t\tif (typeof active === 'function') {\n\t\t\treturn active(frame);\n\t\t}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/freeze.tsx#L23-L59","documentation":"Thrown by <Freeze /> when frame is the value NaN. This typically results from an arithmetic bug (0/0, parsing failure, undefined math) rather than a missing prop.","triggerScenarios":"Passing frame={someCalc} where someCalc evaluated to NaN — e.g. Number(undefined), parseInt failure, or division by zero.","commonSituations":"Frame computed from optional input props that resolved to undefined then coerced via Number(); broken arithmetic in a frame-calculation helper.","solutions":["Trace the NaN to its source: log the operands of the frame expression.","Default the operands: frame={(a ?? 0) / (b ?? 1)}.","Guard before render: if (Number.isNaN(frame)) return null;.","Use Remotion's interpolate with clamp to avoid undefined math."],"exampleFix":"// before\nconst frame = Number(input.offset) / step; // NaN when input.offset undefined\n<Freeze frame={frame}>{scene}</Freeze>\n\n// after\nconst offset = typeof input.offset === 'number' ? input.offset : 0;\n<Freeze frame={offset / step}>{scene}</Freeze>","handlingStrategy":"validation","validationCode":"const frame = computeFrame(input);\nif (Number.isNaN(frame)) {\n  console.warn('frame resolved to NaN; defaulting to 0');\n  return <Freeze frame={0}>{children}</Freeze>;\n}\nreturn <Freeze frame={frame}>{children}</Freeze>;","typeGuard":"const isRealNumber = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":null,"preventionTips":["Default operands in frame arithmetic (a ?? 0, b ?? 1).","Log intermediate values when computing frames from optional input.","Use interpolate with clamp rather than hand-rolled division."],"tags":["react","component","freeze","props","nan"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}