{"record":{"id":"a7966a2ac7b5183d","repo":"heygen-com/hyperframes","slug":"lut-3d-size-lut3dsize-exceeds-max-maxsize","errorCode":null,"errorMessage":"LUT_3D_SIZE ${lut3dSize} exceeds max ${maxSize}","messagePattern":"LUT_3D_SIZE (.+?) exceeds max (.+?)","errorType":"validation","errorClass":"CubeLutParseError","httpStatus":null,"severity":"error","filePath":"packages/core/src/colorLuts.ts","lineNumber":145,"sourceCode":"        throw new CubeLutParseError(`${keyword} expects two numbers`, lineNumber);\n      }\n      const min = parseFiniteNumber(rest[0]!, lineNumber);\n      const max = parseFiniteNumber(rest[1]!, lineNumber);\n      if (max <= min) {\n        throw new CubeLutParseError(\"LUT_3D_INPUT_RANGE max must exceed min\", lineNumber);\n      }\n      domainMin = [min, min, min];\n      domainMax = [max, max, max];\n      continue;\n    }\n    if (keyword === \"LUT_1D_SIZE\") {\n      lut1dSize = parseSize(rest[0], keyword, lineNumber);\n      continue;\n    }\n    if (keyword === \"LUT_3D_SIZE\") {\n      lut3dSize = parseSize(rest[0], keyword, lineNumber);\n      if (lut3dSize > maxSize) {\n        throw new CubeLutParseError(`LUT_3D_SIZE ${lut3dSize} exceeds max ${maxSize}`, lineNumber);\n      }\n      continue;\n    }\n\n    if (!isNumericDataLine(keyword)) {\n      if (keyword.startsWith(\"LUT_\")) {\n        throw new CubeLutParseError(`Unsupported cube keyword ${keyword}`, lineNumber);\n      }\n      continue;\n    }\n    if (!lut3dSize) {\n      if (lut1dSize) {\n        throw new CubeLutParseError(\"1D cube LUTs are not supported yet\", lineNumber);\n      }\n      throw new CubeLutParseError(\"LUT data appears before LUT_3D_SIZE\", lineNumber);\n    }\n    if (parts.length !== 3) {\n      throw new CubeLutParseError(\"LUT data rows must contain three numbers\", lineNumber);","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/core/src/colorLuts.ts#L127-L163","documentation":"parseCubeLut clamps the accepted 3D LUT size to options.maxSize, defaulting to DEFAULT_MAX_CUBE_LUT_SIZE (64). The check at line 144 rejects any LUT_3D_SIZE larger than that cap. The bound exists because a size-N 3D LUT allocates N^3 RGB triples (size 65 = 274,625 floats, size 256 = ~16.7M).","triggerScenarios":"Parsing a file whose 'LUT_3D_SIZE N' has N > maxSize (default 64). Common N values from pro color tools: 65, 128, 256.","commonSituations":"Loading a high-resolution LUT exported from DaVinci Resolve, Lustre, or similar; a default cap that is too low for the asset pipeline.","solutions":["Raise the cap explicitly via parseCubeLut(text, { maxSize: 256 }) — only do this if you can afford the memory (N^3 * 3 floats).","Re-export the LUT at a smaller size (e.g. 33 or 64) from the source tool.","Stream or downsample the LUT externally before parsing."],"exampleFix":"// before\nparseCubeLut(fileText); // throws for LUT_3D_SIZE 128\n\n// after — opt into a larger cap\nparseCubeLut(fileText, { maxSize: 256 });","handlingStrategy":"try-catch","validationCode":"function chooseMaxSize(fileText: string, hardCap = 512): number {\n  const m = /^LUT_3D_SIZE\\s+(\\d+)/m.exec(fileText);\n  const declared = m ? Number(m[1]) : 0;\n  if (!Number.isInteger(declared) || declared < 2) return 64;\n  return Math.min(Math.max(declared, 64), hardCap);\n}\n\nparseCubeLut(fileText, { maxSize: chooseMaxSize(fileText) });","typeGuard":null,"tryCatchPattern":"try {\n  parseCubeLut(fileText);\n} catch (err) {\n  if (err instanceof CubeLutParseError && /exceeds max/.test(err.message)) {\n    // either re-parse with a higher maxSize, or downsample externally\n    const size = Number(/^LUT_3D_SIZE\\s+(\\d+)/m.exec(fileText)?.[1] ?? 0);\n    parseCubeLut(fileText, { maxSize: size });\n  } else throw err;\n}","preventionTips":["Pass an explicit maxSize matching your asset budget: parseCubeLut(text, { maxSize: 256 }).","Prefer LUTs at size 33 or 64 for browser/GPU budgets.","Downsample large LUTs in the build step rather than at runtime."],"tags":["lut","cube","size","limits"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}