{"record":{"id":"92c1f374e8ff3cd4","repo":"remotion-dev/remotion","slug":"expected-data-length-3-lut-colors-got-more","errorCode":null,"errorMessage":"Expected ${data.length / 3} LUT colors, got more.","messagePattern":"Expected (.+?) LUT colors, got more\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/helpers/cube-lut.ts","lineNumber":118,"sourceCode":"\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);\n\t}\n\n\tif (domainMin.some((min, channel) => min >= domainMax[channel])) {\n\t\tthrow new Error(","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio/src/helpers/cube-lut.ts#L100-L136","documentation":"Once the LUT size header is known, the parser allocates a Float32Array holding exactly size*3 (1D) or size^3*3 (3D) floats, i.e. data.length/3 color entries. This error is thrown when a color line arrives after the table is already full — the file contains more color rows than the declared size allows. The message reports the exact expected count so the mismatch is obvious.","triggerScenarios":"parseCubeLut(text) where the declared LUT_3D_SIZE n implies n^3 colors but the file contains more than n^3 data lines (e.g. declared 32 while the table has 33^3 entries), or a 1D LUT declared with LUT_1D_SIZE smaller than its actual table length.","commonSituations":"Size header edited after export (author shrank LUT_3D_SIZE to save space but kept the full table); files exported at one resolution and patched to another; truncated re-save that kept the old (larger) table but lowered the header value.","solutions":["Correct the size header to match the actual number of color rows (e.g. set LUT_3D_SIZE 33 for 35937 rows, cube root of the data-line count).","Remove the surplus trailing color lines.","Re-export the LUT so the header and table agree.","Pre-count non-header data lines in the text and compare with the declared size^3 before parsing."],"exampleFix":"// before (8 rows of data)\nLUT_1D_SIZE 4\n// after\nLUT_1D_SIZE 8","handlingStrategy":"validation","validationCode":"const sizeMatch = /LUT_3D_SIZE\\s+(\\d+)/.exec(text);\nif (sizeMatch) {\n  const n = Number(sizeMatch[1]);\n  const rows = text.split(/\\r?\\n/).filter((l) => {\n    const p = l.trim().split(/\\s+/);\n    return p.length === 3 && p.every((x) => Number.isFinite(Number(x)));\n  }).length;\n  if (rows > n ** 3) throw new Error(`Header says ${n ** 3} colors, file has ${rows}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const lut = parseCubeLut(text);\n} catch (e) {\n  if (/got more/.test((e as Error).message)) {\n    console.error('Declared LUT size is smaller than the color table');\n  }\n}","preventionTips":["Never edit LUT_*_SIZE without regenerating the color table","Count data lines and verify size^3 matches before shipping a LUT","Keep the size header and table from the same export"],"tags":["parsing","lut","validation"],"backgroundTag":"value-out-of-range","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"}