{"record":{"id":"4a1dc56e07be981a","repo":"remotion-dev/remotion","slug":"duplicate-keyword-on-line-index-1","errorCode":null,"errorMessage":"Duplicate ${keyword} on line ${index + 1}.","messagePattern":"Duplicate (.+?) on line (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/helpers/cube-lut.ts","lineNumber":39,"sourceCode":"\n\tfor (const [index, rawLine] of text.split(/\\r\\n?|\\n/).entries()) {\n\t\tconst line = rawLine.trim();\n\t\tif (!line || line.startsWith('#')) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst titleMatch = line.match(/^TITLE\\s+\"([^\"]*)\"\\s*(?:#.*)?$/);\n\t\tconst [keyword, ...values] = line.replace(/#.*$/, '').trim().split(/\\s+/);\n\t\tconst numbers = values.map(Number);\n\t\tconst isHeader = /^[A-Z][A-Z0-9_]*$/.test(keyword);\n\n\t\tif (isHeader) {\n\t\t\tif (offset > 0) {\n\t\t\t\tthrow new Error(`LUT header after color data on line ${index + 1}.`);\n\t\t\t}\n\n\t\t\tif (headers.has(keyword)) {\n\t\t\t\tthrow new Error(`Duplicate ${keyword} on line ${index + 1}.`);\n\t\t\t}\n\n\t\t\theaders.add(keyword);\n\t\t}\n\n\t\tif (keyword === 'TITLE' && titleMatch) {\n\t\t\ttitle = titleMatch[1];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (keyword === 'LUT_1D_SIZE' || keyword === 'LUT_3D_SIZE') {\n\t\t\tif (type !== null) {\n\t\t\t\tthrow new Error('Combined 1D and 3D LUTs are not supported.');\n\t\t\t}\n\n\t\t\ttype = keyword === 'LUT_1D_SIZE' ? '1d' : '3d';\n\t\t\tsize = numbers[0];\n\t\t\tconst maxSize = type === '1d' ? 65536 : 256;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio/src/helpers/cube-lut.ts#L21-L57","documentation":"parseCubeLut collects header keywords into a set and rejects a .cube file that declares the same keyword twice, e.g. two TITLE or two LUT_3D_SIZE lines, since the parser could not decide which value is authoritative.","triggerScenarios":"Loading a .cube file that contains a duplicated header keyword — like two TITLE lines or LUT_3D_SIZE declared twice — anywhere before color data.","commonSituations":"Concatenated or merge-conflicted .cube files; copy-paste editing that duplicated a header; buggy exporter emitting repeated headers.","solutions":["Remove the duplicate header line so each keyword appears exactly once.","Keep only the intended TITLE / LUT_*_SIZE declaration and delete the other.","Re-export the LUT from the source tool.","Check git history if the file was recently merged."],"exampleFix":"// before\nTITLE \"A\"\nTITLE \"B\"\n// after\nTITLE \"A\"","handlingStrategy":"validation","validationCode":"const seen = new Set();\nfor (const line of headerLines) {\n  const kw = line.split(/\\s+/)[0];\n  if (seen.has(kw)) throw new Error(`Duplicate keyword: ${kw}`);\n  seen.add(kw);\n}","typeGuard":"null","tryCatchPattern":"try {\n  parseCubeLut(text);\n} catch (err) {\n  if (err.message.startsWith('Duplicate')) {\n    // surface which keyword/line is duplicated\n  }\n}","preventionTips":["Deduplicate headers before parsing","Avoid concatenating .cube files","Check merge conflicts in LUT files before committing"],"tags":["lut","parsing","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"}