{"record":{"id":"5446aabf1ea660e5","repo":"remotion-dev/remotion","slug":"posterize-must-be-a-positive-finite-number-but-go","errorCode":null,"errorMessage":"posterize must be a positive finite number, but got ${posterize}","messagePattern":"posterize must be a positive finite number, but got (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1076,"sourceCode":"\t\tif (typeof easing[i] !== 'function') {\n\t\t\tthrow new Error(`easing[${i}] must be a function`);\n\t\t}\n\t}\n}\n\nexport function assertValidInterpolatePosterizeOption(\n\tposterize: number | undefined,\n) {\n\tif (posterize === undefined) {\n\t\treturn;\n\t}\n\n\tif (\n\t\ttypeof posterize !== 'number' ||\n\t\t!Number.isFinite(posterize) ||\n\t\tposterize <= 0\n\t) {\n\t\tthrow new Error(\n\t\t\t`posterize must be a positive finite number, but got ${posterize}`,\n\t\t);\n\t}\n}\n\nfunction assertValidInterpolateOutputOption(\n\toutput: InterpolateOptions['output'],\n) {\n\tif (\n\t\toutput === undefined ||\n\t\toutput === 'linear' ||\n\t\toutput === 'perceptual-scale'\n\t) {\n\t\treturn;\n\t}\n\n\tthrow new Error(\n\t\t`output must be \"linear\" or \"perceptual-scale\", but got ${String(output)}`,","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L1058-L1094","documentation":"Thrown by assertValidInterpolatePosterizeOption. The posterize option controls how many discrete steps the interpolated output is snapped to; it must be a finite number strictly greater than 0. Zero, negatives, NaN, Infinity, and non-numbers are all rejected.","triggerScenarios":"interpolate(t, [0,1], [0,100], {posterize: 0}); {posterize: -4}; {posterize: NaN}; {posterize: '5'}; computing posterize from a config that defaults to 0.","commonSituations":"Tying posterize to a dynamic value that can hit 0 (e.g. a slider's minimum); passing a string from user input; Infinity from an unchecked division.","solutions":["Set posterize to a positive finite integer (e.g. 8 or 10).","Clamp the computed posterize to a minimum of 1 before passing it.","Omit the option entirely if you do not need stepped output."],"exampleFix":"// before\nconst r = interpolate(t, [0, 1], [0, 100], {posterize: 0});\n// after\nconst r = interpolate(t, [0, 1], [0, 100], {posterize: 8});","handlingStrategy":"validation","validationCode":"if (\n  posterize !== undefined &&\n  (typeof posterize !== 'number' || !Number.isFinite(posterize) || posterize <= 0)\n) {\n  throw new Error('posterize must be a positive finite number');\n}\nconst r = interpolate(input, inputRange, outputRange, {posterize});","typeGuard":"const isValidPosterize = (p: unknown): p is number | undefined =>\n  p === undefined || (typeof p === 'number' && Number.isFinite(p) && p > 0);","tryCatchPattern":null,"preventionTips":["Clamp dynamic posterize to a minimum of 1.","Omit the option when stepped output is not required.","Validate user-driven slider values before binding them to posterize."],"tags":["interpolation","validation","posterize"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}