{"record":{"id":"c4e98b08657e071c","repo":"remotion-dev/remotion","slug":"invalid-lut-color-on-line-index-1","errorCode":null,"errorMessage":"Invalid LUT color on line ${index + 1}.","messagePattern":"Invalid LUT color on line (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/helpers/cube-lut.ts","lineNumber":114,"sourceCode":"\t\t\tcontinue;\n\t\t}\n\n\t\tif (isHeader) {\n\t\t\tthrow new Error(\n\t\t\t\t`Unsupported LUT header \"${keyword}\" on line ${index + 1}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (data === null) {\n\t\t\tthrow new Error('Expected LUT_1D_SIZE or LUT_3D_SIZE before color data.');\n\t\t}\n\n\t\tconst color = [Number(keyword), ...numbers];\n\t\tif (\n\t\t\tcolor.length !== 3 ||\n\t\t\t!color.every((value) => Number.isFinite(Math.fround(value)))\n\t\t) {\n\t\t\tthrow new Error(`Invalid LUT color on line ${index + 1}.`);\n\t\t}\n\n\t\tif (offset + 3 > data.length) {\n\t\t\tthrow new Error(`Expected ${data.length / 3} LUT colors, got more.`);\n\t\t}\n\n\t\tdata.set(color, offset);\n\t\toffset += 3;\n\t}\n\n\tif (type === null || data === null) {\n\t\tthrow new Error('Expected LUT_1D_SIZE or LUT_3D_SIZE.');\n\t}\n\n\tif (offset !== data.length) {\n\t\tthrow new Error(\n\t\t\t`Expected ${data.length / 3} LUT colors, got ${offset / 3}.`,\n\t\t);","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio/src/helpers/cube-lut.ts#L96-L132","documentation":"Every data line in a .cube file must be exactly three finite numbers (r g b). parseCubeLut builds a color from the first token plus the remaining tokens and throws this error when the line does not yield exactly 3 values, or any value is not finite after Math.fround (NaN, Infinity, or non-numeric tokens). The 1-based line number is included so the broken row can be located quickly.","triggerScenarios":"parseCubeLut(text) with a data line like '0.5 0.5' (two values), 'r g b' (non-numeric tokens that slipped past the header regex, e.g. lowercase), '1 2 3 4' (four values), or containing NaN/Infinity values.","commonSituations":"CSV-exported data pasted into .cube files; files with tab/comma separators where split(/\\s+/) still works but one field is empty; locale-formatted numbers ('0,5 0,5 0,5') that Number() turns into NaN; extra alpha channel column.","solutions":["Fix the reported line to contain exactly three whitespace-separated finite decimal numbers.","Replace comma decimal separators with dots and remove any thousands separators.","Delete extra columns (e.g. alpha or index) so only r g b remain.","Re-export the LUT from the source application.","Pre-validate each data line with a regex like /^[\\d.eE+-.]+\\s+[\\d.eE+-.]+\\s+[\\d.eE+-.]+$/ before calling parseCubeLut."],"exampleFix":"// before (comma decimals)\n0,5 0,5 0,5\n// after\n0.5 0.5 0.5","handlingStrategy":"validation","validationCode":"const isColorLine = (line: string): boolean => {\n  const parts = line.trim().split(/\\s+/);\n  return parts.length === 3 && parts.every((p) => Number.isFinite(Number(p)));\n};","typeGuard":null,"tryCatchPattern":"try {\n  const lut = parseCubeLut(text);\n} catch (e) {\n  const m = /line (\\d+)/.exec((e as Error).message);\n  if (m) console.error(`Bad color row at line ${m[1]}`);\n}","preventionTips":["Use dots, not commas, as decimal separators in .cube data","Keep exactly three whitespace-separated columns per data line","Re-export rather than hand-editing color tables"],"tags":["parsing","lut","validation"],"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"}