{"record":{"id":"1baed33fb2e86091","repo":"remotion-dev/remotion","slug":"keyword-must-be-an-integer-from-2-to-maxsize","errorCode":null,"errorMessage":"${keyword} must be an integer from 2 to ${maxSize}.","messagePattern":"(.+?) must be an integer from 2 to (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/helpers/cube-lut.ts","lineNumber":64,"sourceCode":"\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;\n\t\t\tif (\n\t\t\t\tnumbers.length !== 1 ||\n\t\t\t\t!Number.isInteger(size) ||\n\t\t\t\tsize < 2 ||\n\t\t\t\tsize > maxSize\n\t\t\t) {\n\t\t\t\tthrow new Error(`${keyword} must be an integer from 2 to ${maxSize}.`);\n\t\t\t}\n\n\t\t\tdata = new Float32Array((type === '1d' ? size : size ** 3) * 3);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (keyword === 'DOMAIN_MIN' || keyword === 'DOMAIN_MAX') {\n\t\t\tif (numbers.length !== 3 || !numbers.every(Number.isFinite)) {\n\t\t\t\tthrow new Error(`${keyword} must contain three finite numbers.`);\n\t\t\t}\n\n\t\t\tif (keyword === 'DOMAIN_MIN') {\n\t\t\t\tdomainMin = [numbers[0], numbers[1], numbers[2]];\n\t\t\t} else {\n\t\t\t\tdomainMax = [numbers[0], numbers[1], numbers[2]];\n\t\t\t}\n\n\t\t\tcontinue;","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio/src/helpers/cube-lut.ts#L46-L82","documentation":"The LUT_1D_SIZE or LUT_3D_SIZE keyword must have exactly one integer value within allowed bounds (1D: 2–65536, 3D: 2–256). parseCubeLut throws when the value is missing, non-numeric, fractional, or out of range.","triggerScenarios":"Loading a .cube file whose size line is like 'LUT_3D_SIZE' (no value), 'LUT_3D_SIZE 2.5', 'LUT_3D_SIZE 0', or 'LUT_3D_SIZE 1024' (exceeds the 3D max of 256).","commonSituations":"Corrupted or truncated header lines; LUTs from tools using non-standard sizes; typos in hand-edited files.","solutions":["Set the size line to a single valid integer (2–256 for LUT_3D_SIZE, 2–65536 for LUT_1D_SIZE).","Regenerate the LUT data to match the declared size, or change the size to match the data.","Re-export the LUT from its tool with a standard size (e.g. 33 for 3D).","Fix truncated lines in the file if the value was cut off."],"exampleFix":"// before\nLUT_3D_SIZE 1024\n// after\nLUT_3D_SIZE 256","handlingStrategy":"validation","validationCode":"const m = text.match(/^LUT_(1D|3D)_SIZE\\s+(\\S+)/m);\nconst limits = {'1D': 65536, '3D': 256};\nif (!m || !Number.isInteger(+m[2]) || +m[2] < 2 || +m[2] > limits[m[1]]) throw new Error(`Invalid ${m?.[0] ?? 'size'}`);","typeGuard":"null","tryCatchPattern":"try {\n  parseCubeLut(text);\n} catch (err) {\n  if (err.message.includes('must be an integer from 2 to')) {\n    // show size constraints to user\n  }\n}","preventionTips":["Use standard LUT sizes (e.g. 33 for 3D, 32/64/256 for 1D)","Verify size lines are not truncated or corrupted","Validate numeric headers before parsing"],"tags":["lut","parsing","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"}