{"record":{"id":"d44f4001faa43300","repo":"remotion-dev/remotion","slug":"name-must-be-a-finite-number","errorCode":null,"errorMessage":"\"${name}\" must be a finite number","messagePattern":"\"(.+?)\" must be a finite number","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/brand/src/effects/metallic-swirl-effect.ts","lineNumber":281,"sourceCode":"const assertParamsObject = (\n\tparams: MetallicSwirlParams,\n\tname: string,\n): void => {\n\tif (params === null || typeof params !== 'object' || Array.isArray(params)) {\n\t\tthrow new TypeError(`${name} params must be an object`);\n\t}\n};\n\nconst assertOptionalFiniteNumber = (\n\tvalue: unknown,\n\tname: keyof MetallicSwirlParams,\n): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\tthrow new TypeError(`\"${name}\" must be a finite number`);\n\t}\n};\n\nconst validateRange = (\n\tvalue: number,\n\tname: keyof MetallicSwirlParams,\n\tmin: number,\n\tmax: number,\n): void => {\n\tif (value < min || value > max) {\n\t\tthrow new TypeError(`\"${name}\" must be between ${min} and ${max}`);\n\t}\n};\n\nconst assertOptionalEnum = <T extends string>(\n\tvalue: unknown,\n\tname: keyof MetallicSwirlParams,\n\tvariants: readonly T[],","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L263-L299","documentation":"`assertOptionalFiniteNumber` runs for every optional numeric field of `MetallicSwirlParams` (time, speed, zoom, iterations, sampleGap, tangentForce, gradientForce, colorPhaseR/G/B, colorRange, colorBias, brightness, opacity). `undefined` is allowed (the field is optional), but any other non-number, or any non-finite number (Infinity/NaN), throws. The message names the offending field.","triggerScenarios":"`metallicSwirl({speed: '2'})` (string), `metallicSwirl({zoom: true})` (boolean), `metallicSwirl({opacity: null})`, `metallicSwirl({brightness: Infinity})`, `metallicSwirl({iterations: NaN})`, or passing a value from `parseFloat` that returned NaN.","commonSituations":"Numeric values arriving as strings from forms, URL params, or JSON without coercion; division producing Infinity/NaN upstream; booleans used as 0/1 stand-ins; null used to mean 'unset' instead of omitting the key.","solutions":["Coerce numeric strings: `metallicSwirl({speed: Number(raw.speed)})`.","Use `undefined` (or omit the key) to mean 'unset', never `null`.","Guard computed values: `Number.isFinite(v) ? v : undefined`.","Type the params as `MetallicSwirlParams` so non-numbers are flagged."],"exampleFix":"// before\nmetallicSwirl({speed: formData.speed}); // formData.speed is a string\n\n// after\nmetallicSwirl({speed: Number(formData.speed)});","handlingStrategy":"type-guard","validationCode":"// Coerce/validate optional numeric params before passing.\nconst optionalFinite = (v: unknown): number | undefined => {\n  if (v === undefined || v === null) return undefined;\n  const n = typeof v === 'number' ? v : Number(v);\n  if (!Number.isFinite(n)) {\n    throw new Error(`Expected a finite number, got ${JSON.stringify(v)}`);\n  }\n  return n;\n};\nmetallicSwirl({speed: optionalFinite(raw.speed)});","typeGuard":"type OptionalFinite = number | undefined;\n\nconst isOptionalFinite = (v: unknown): v is OptionalFinite =>\n  v === undefined || (typeof v === 'number' && Number.isFinite(v));","tryCatchPattern":null,"preventionTips":["Coerce numeric strings with `Number(v)` before passing them in.","Use `undefined` (or omit the key) to mean 'unset', never `null`.","Validate `parseInt`/`parseFloat` results with `Number.isFinite` upstream.","Type params as `MetallicSwirlParams` so non-numbers surface at compile time."],"tags":["brand","metallic-swirl","validation","params","number"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}