{"record":{"id":"ad353c93d4ad1429","repo":"remotion-dev/remotion","slug":"font-weight-outputrange-must-contain-only-numbers-or-strings","errorCode":null,"errorMessage":"Font weight outputRange must contain only numbers or strings","messagePattern":"Font weight outputRange must contain only numbers or strings","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1329,"sourceCode":"\tassertValidInterpolateOutputOption(options?.output);\n\tassertValidInterpolateOutputType(options?.outputType);\n\n\tif (typeof input !== 'number') {\n\t\tthrow new TypeError('Cannot interpolate an input which is not a number');\n\t}\n\n\tif (!Array.isArray(outputRange)) {\n\t\tthrow new Error('outputRange must contain only numbers');\n\t}\n\n\tconst outputType = options?.outputType;\n\tif (outputType === 'font-weight') {\n\t\tif (\n\t\t\t!outputRange.every(\n\t\t\t\t(output) => typeof output === 'number' || typeof output === 'string',\n\t\t\t)\n\t\t) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'Font weight outputRange must contain only numbers or strings',\n\t\t\t);\n\t\t}\n\n\t\treturn interpolateFontWeight({\n\t\t\tinput,\n\t\t\tinputRange,\n\t\t\toutputRange,\n\t\t\toptions,\n\t\t});\n\t}\n\n\tconst hasStringOutput = outputRange.some(\n\t\t(output) => typeof output === 'string',\n\t);\n\tif (outputType !== undefined && outputType !== 'scale' && !hasStringOutput) {\n\t\tthrow new TypeError(\n\t\t\t`${outputType} outputRange must contain strings with the appropriate CSS units`,","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/core/src/interpolate.ts#L1311-L1347","documentation":"When `outputType: 'font-weight'` is used with interpolateColors, every entry of the outputRange must be a number or a string (e.g. 400 or 'bold'-style numeric weights as strings). Remotion throws a TypeError if any element is neither, because font-weight interpolation cannot consume color/other values.","triggerScenarios":"Calling `interpolateColors(input, inputRange, outputRange, {outputType: 'font-weight'})` where outputRange contains objects, arrays, null, undefined, booleans, or color strings like '#ff0000'.","commonSituations":"Reusing an existing color outputRange with outputType switched to 'font-weight', forgetting to replace hex colors with numeric weights, or having a malformed/undefined entry in the array.","solutions":["Replace every outputRange entry with numeric font weights (100-900) or weight strings, e.g. [400, 700].","Remove color strings (hex/rgb/named colors) from the outputRange when using font-weight outputType.","Verify each element's type with outputRange.every((o) => typeof o === 'number' || typeof o === 'string')."],"exampleFix":"// before\ninterpolateColors(progress, [0, 1], ['#000000', '#ffffff'], {outputType: 'font-weight'});\n// after\ninterpolateColors(progress, [0, 1], [400, 700], {outputType: 'font-weight'});","handlingStrategy":"type-guard","validationCode":"if (!outputRange.every((o) => typeof o === 'number' || typeof o === 'string')) {\n  throw new TypeError('outputRange for font-weight must contain only numbers or strings');\n}","typeGuard":"const isFontWeightRange = (r: unknown[]): r is (number|string)[] =>\n  r.every((o) => typeof o === 'number' || typeof o === 'string');","tryCatchPattern":"try {\n  return interpolateColors(input, inputRange, outputRange, {outputType: 'font-weight'});\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('Font weight outputRange')) {\n    console.error('outputRange must be numbers/strings, got:', outputRange);\n  }\n  throw e;\n}","preventionTips":["Keep font-weight ranges purely numeric (100-900) and separate from color ranges.","Never reuse a hex-color outputRange for font-weight outputType.","Add an assertion on the range before rendering data-driven videos.","Write the range as a typed constant so wrong values fail at compile time."],"tags":["validation","typeerror","interpolation"],"backgroundTag":"invalid-argument-format","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}