{"record":{"id":"914243ec6758c518","repo":"remotion-dev/remotion","slug":"invalid-lut-content-on-line-linenumber-lut-3d-size-may-only","errorCode":null,"errorMessage":"Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE may only be declared once","messagePattern":"Invalid LUT content on line (.+?): LUT_3D_SIZE may only be declared once","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/lut/parse-cube-lut.ts","lineNumber":101,"sourceCode":"\t\t\t\tthrow new TypeError(\n\t\t\t\t\t`Invalid LUT content on line ${lineNumber}: ${keyword} must appear before the color data`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (keyword === 'TITLE') {\n\t\t\t\tif (hasTitle) {\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`Invalid LUT content on line ${lineNumber}: TITLE may only be declared once`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\thasTitle = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (keyword === 'LUT_3D_SIZE') {\n\t\t\t\tif (size !== null) {\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE may only be declared once`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (values.length !== 1) {\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must contain exactly one integer`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst parsedSize = Number(values[0]);\n\t\t\t\tif (\n\t\t\t\t\t!Number.isInteger(parsedSize) ||\n\t\t\t\t\tparsedSize < 2 ||\n\t\t\t\t\tparsedSize > 256\n\t\t\t\t) {\n\t\t\t\t\tthrow new TypeError(\n\t\t\t\t\t\t`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must be an integer from 2 to 256`,","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/effects/src/lut/parse-cube-lut.ts#L83-L119","documentation":"LUT_3D_SIZE defines the grid dimension of a 3D LUT and may appear only once per file. parseCubeLut() throws this TypeError when a second LUT_3D_SIZE directive is found, because a single LUT cannot have two grid sizes.","triggerScenarios":"parseCubeLut() is given content with two LUT_3D_SIZE lines, e.g. 'LUT_3D_SIZE 2' and later 'LUT_3D_SIZE 32'.","commonSituations":"Merged or concatenated LUT files, hand-edited files where the size was changed by adding a new line instead of editing the old one.","solutions":["Delete the extra LUT_3D_SIZE line, keeping the one matching the actual number of color rows (rows must equal size^3)","Fix the existing LUT_3D_SIZE value in place instead of adding a second declaration","Re-export the LUT with a single correct size"],"exampleFix":"// before\nLUT_3D_SIZE 2\nLUT_3D_SIZE 32\n...color rows...\n// after\nLUT_3D_SIZE 32\n...color rows...","handlingStrategy":"validation","validationCode":"const sizes = content.split(/\\r?\\n/).filter((l) => l.trim().startsWith('LUT_3D_SIZE'));\nif (sizes.length !== 1) throw new Error(`Expected exactly one LUT_3D_SIZE, got ${sizes.length}`);","typeGuard":"null","tryCatchPattern":"try {\n  const lut = parseCubeLut(content);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('LUT_3D_SIZE may only be declared once')) {\n    // strip duplicate size lines and retry\n  } else throw e;\n}","preventionTips":["Edit the existing LUT_3D_SIZE line rather than adding a new one","Deduplicate headers when merging LUT files"],"tags":["validation","lut","duplicate-directive"],"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"}