{"record":{"id":"14f96f2ada66c9fc","repo":"remotion-dev/remotion","slug":"argument-passed-for-frame-is-not-a-number-fra","errorCode":null,"errorMessage":"Argument passed for \"frame\" is not a number: ${frame}","messagePattern":"Argument passed for \"frame\" is not a number: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validate-frame.ts","lineNumber":15,"sourceCode":"export const validateFrame = ({\n\tallowFloats,\n\tdurationInFrames,\n\tframe,\n}: {\n\tframe: number;\n\tdurationInFrames: number;\n\tallowFloats: boolean;\n}) => {\n\tif (typeof frame === 'undefined') {\n\t\tthrow new TypeError(`Argument missing for parameter \"frame\"`);\n\t}\n\n\tif (typeof frame !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Argument passed for \"frame\" is not a number: ${frame}`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(frame)) {\n\t\tthrow new RangeError(`Frame ${frame} is not finite`);\n\t}\n\n\tif (frame % 1 !== 0 && !allowFloats) {\n\t\tthrow new RangeError(\n\t\t\t`Argument for frame must be an integer, but got ${frame}`,\n\t\t);\n\t}\n\n\tif (frame < 0 && frame < -durationInFrames) {\n\t\tthrow new RangeError(\n\t\t\t`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`,\n\t\t);","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validate-frame.ts#L1-L33","documentation":"validateFrame throws a TypeError when frame is defined but not of type `number` (e.g. a string, object, NaN-passed-as-non-number). The message echoes the offending value. This catches data flowing from untyped sources (URL params, JSON, props) into frame-based APIs.","triggerScenarios":"Passing a string frame (from a query string, dataset attribute, or JSON) without converting; passing an object/array; passing null; passing a value coerced through loose equality.","commonSituations":"Reading frame from URL search params or localStorage (always strings); deserializing JSON where frame was stored as string; mixing `any`-typed data from APIs; DOM dataset attributes.","solutions":["Convert to number before passing: `Number(rawFrame)` or `parseInt(rawFrame, 10)`.","Validate with typeof before calling: `if (typeof f === 'number') validateFrame(...)`.","Tighten the source type so frame is `number` end-to-end.","Use a schema validator (zod/etc.) on inbound data to coerce frame to number."],"exampleFix":"// before\nconst frame = new URLSearchParams(location.search).get('frame');\nplayer.seekTo(frame); // string\n\n// after\nconst frame = Number(new URLSearchParams(location.search).get('frame'));\nplayer.seekTo(frame);","handlingStrategy":"type-guard","validationCode":"if (typeof frame !== 'number') {\n  frame = Number(frame);\n}\nvalidateFrame({ frame, durationInFrames, allowFloats });","typeGuard":"const isNumericFrame = (f: unknown): f is number => typeof f === 'number';","tryCatchPattern":null,"preventionTips":["Convert string sources (URL params, JSON, dataset) to Number before passing.","Type frame as number end-to-end; avoid `any`.","Validate inbound data with a schema that coerces numeric fields."],"tags":["remotion","frame","validation","typeerror","type-coercion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}