{"record":{"id":"c831e390214dc378","repo":"remotion-dev/remotion","slug":"invalid-lut-content-expected-maxdatarows-color-rows-for-lut","errorCode":null,"errorMessage":"Invalid LUT content: expected ${maxDataRows} color rows for LUT_3D_SIZE ${size}, but got more","messagePattern":"Invalid LUT content: expected (.+?) color rows for LUT_3D_SIZE (.+?), but got more","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/lut/parse-cube-lut.ts","lineNumber":180,"sourceCode":"\t\t}\n\n\t\tif (size === null) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must be declared before the color data`,\n\t\t\t);\n\t\t}\n\n\t\tparseTriplet({\n\t\t\tvalues: [keyword, ...values],\n\t\t\tlineNumber,\n\t\t\tlabel: 'color row',\n\t\t});\n\t\tdataStarted = true;\n\t\tdataRows++;\n\n\t\tconst maxDataRows = size ** 3;\n\t\tif (dataRows > maxDataRows) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Invalid LUT content: expected ${maxDataRows} color rows for LUT_3D_SIZE ${size}, but got more`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (size === null) {\n\t\tthrow new TypeError('Invalid LUT content: LUT_3D_SIZE is missing');\n\t}\n\n\tfor (let channel = 0; channel < 3; channel++) {\n\t\tif (domainMin[channel] >= domainMax[channel]) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`Invalid LUT content: DOMAIN_MIN must be smaller than DOMAIN_MAX for every channel`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst expectedRows = size ** 3;","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/effects/src/lut/parse-cube-lut.ts#L162-L198","documentation":"A LUT_3D_SIZE of N requires exactly N^3 color rows. parseCubeLut() counts rows as it parses and throws this TypeError as soon as more than N^3 data rows appear, preventing silent truncation of extra data.","triggerScenarios":"parseCubeLut() is given a file whose LUT_3D_SIZE is smaller than the actual number of color rows, e.g. size 2 (expecting 8 rows) with 64 rows of data.","commonSituations":"Editing the size value down without removing rows, pasting data from a larger LUT into a smaller-header file, or a generator writing the wrong size.","solutions":["Correct LUT_3D_SIZE to the cube root of the actual color-row count","Trim the extra color rows to match size^3","Re-export the LUT ensuring size and row count agree"],"exampleFix":"// before\nLUT_3D_SIZE 2\n// 64 color rows follow\n// after\nLUT_3D_SIZE 4\n// 64 color rows follow","handlingStrategy":"validation","validationCode":"const sizeMatch = content.match(/^LUT_3D_SIZE\\s+(\\d+)\\s*$/m);\nconst dataRows = content.split(/\\r?\\n/)\n  .map((l) => l.split('#')[0].trim())\n  .filter((l) => l && !/^(TITLE|LUT_3D_SIZE|DOMAIN_MIN|DOMAIN_MAX|LUT_1D_SIZE)\\b/.test(l)).length;\nconst size = sizeMatch ? Number(sizeMatch[1]) : null;\nif (size && dataRows > size ** 3) throw new Error(`Too many rows: ${dataRows} > ${size ** 3}`);","typeGuard":"null","tryCatchPattern":"try {\n  const lut = parseCubeLut(content);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('but got more')) {\n    // fix LUT_3D_SIZE to match the row count, or trim extra rows\n  } else throw e;\n}","preventionTips":["Verify row count equals size^3 before parsing","Never hand-edit LUT_3D_SIZE without adjusting the data rows","Validate LUT files with a preflight check in your pipeline"],"tags":["validation","lut","row-count-mismatch"],"backgroundTag":"schema-validation-failed","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"}