{"record":{"id":"ce245d531466762b","repo":"remotion-dev/remotion","slug":"invalid-lut-content-lut-3d-size-is-missing","errorCode":null,"errorMessage":"Invalid LUT content: LUT_3D_SIZE is missing","messagePattern":"Invalid LUT content: LUT_3D_SIZE is missing","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/lut/parse-cube-lut.ts","lineNumber":187,"sourceCode":"\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;\n\tif (dataRows !== expectedRows) {\n\t\tthrow new TypeError(\n\t\t\t`Invalid LUT content: expected ${expectedRows} color rows for LUT_3D_SIZE ${size}, but got ${dataRows}`,\n\t\t);\n\t}\n\n\tconst data = new Float32Array(expectedRows * 4);","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/effects/src/lut/parse-cube-lut.ts#L169-L205","documentation":"parseCubeLut() parses .cube 3D LUT files and requires a `LUT_3D_SIZE <n>` header directive, which tells the parser the LUT grid dimension (n^3 color rows). If the whole file has been scanned and no LUT_3D_SIZE directive was found, the parser throws this TypeError because the row count and data layout cannot be determined.","triggerScenarios":"Calling parseCubeLut(content) with a string that lacks any `LUT_3D_SIZE` line — e.g. a 1D LUT without a size directive, a file where the directive is commented out (anything after an unquoted `#` is stripped), a typo like `LUT_3D_Size` (case-sensitive keyword), or a completely unrelated/empty string passed as LUT content.","commonSituations":"Loading a .cube file downloaded from the wrong format (1D curves vs 3D LUTs), hand-edited LUT files where the header was accidentally deleted, fetching a LUT over the network and receiving an HTML error page instead of the file, or passing a base64/binary LUT format instead of ASCII .cube text.","solutions":["Add a valid `LUT_3D_SIZE <n>` directive to the file header before the color data, where n matches the cube size","Verify the file actually is a .cube LUT and not a 1D LUT (.cube 1D uses LUT_1D_SIZE, which is rejected earlier) — obtain a 3D LUT instead","Check that the LUT_3D_SIZE line is not commented out (no `#` before it) and the keyword casing is exactly `LUT_3D_SIZE`","Make sure the content loaded is plain text (e.g. `await fetch(url).then(r => r.text())`, not `.arrayBuffer()`), and not an error page"],"exampleFix":"// before\nconst lut = parseCubeLut(fileContents); // file has no LUT_3D_SIZE line\n// after\n// add to the .cube file header:\n// TITLE \"My LUT\"\n// LUT_3D_SIZE 33\n// then:\nconst lut = parseCubeLut(fileContents);","handlingStrategy":"validation","validationCode":"const hasSize = /^LUT_3D_SIZE\\s+\\d+\\s*$/m.test(content.replace(/#[^\\n\\\"]*/g, ''));\nif (!hasSize) throw new Error('Not a 3D .cube LUT: missing LUT_3D_SIZE');","typeGuard":"const is3dCubeLut = (content: string): boolean =>\n  content.split(/\\r?\\n/).some((line) => /^LUT_3D_SIZE\\s+\\d+$/.test(line.trim().split('#')[0].trim()));","tryCatchPattern":"let lut;\ntry {\n  lut = parseCubeLut(content);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('LUT_3D_SIZE is missing')) {\n    throw new Error('File is not a 3D .cube LUT (no LUT_3D_SIZE header)');\n  }\n  throw e;\n}","preventionTips":["Always fetch LUT files as text (response.text()), never as binary/JSON","Validate the header contains LUT_3D_SIZE before parsing","Keep a known-good sample .cube file in tests","Watch for fetch() returning HTML error pages with status 200"],"tags":["lut","validation","file-format"],"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"}