{"record":{"id":"9b78f8dc47598207","repo":"heygen-com/hyperframes","slug":"lut-for-cell-label-is-not-a-valid-cube-no","errorCode":null,"errorMessage":"LUT for \"${cell.label}\" is not a valid .cube: ${normalizeErrorMessage(err)}","messagePattern":"LUT for \"(.+?)\" is not a valid \\.cube: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/grade-compare.ts","lineNumber":449,"sourceCode":"  const tempDir = mkdtempSync(join(tmpdir(), \"hf-grade-compare-\"));\n  try {\n    const frameFileName = opts.frameFileName ?? frameFileNameForPath(opts.framePath);\n    writeFileSync(join(tempDir, frameFileName), opts.frameBuffer);\n\n    let lutIndex = 0;\n    const stagedCells = opts.cells.map((cell) => {\n      const lutSrc = lutSrcFromGrading(cell.grading);\n      if (!lutSrc) return cell;\n\n      const sourcePath = resolveFromBase(opts.projectDir, lutSrc);\n      if (!existsSync(sourcePath)) {\n        throw new Error(`LUT file not found for \"${cell.label}\": ${sourcePath}`);\n      }\n      const lutText = readFileSync(sourcePath, \"utf-8\");\n      try {\n        parseCubeLut(lutText, { maxSize: 64 });\n      } catch (err) {\n        throw new Error(\n          `LUT for \"${cell.label}\" is not a valid .cube: ${normalizeErrorMessage(err)}`,\n        );\n      }\n      const lutExt = extname(sourcePath) || \".cube\";\n      const stagedName = `lut-${lutIndex}${lutExt}`;\n      lutIndex += 1;\n      copyFileSync(sourcePath, join(tempDir, stagedName));\n      return {\n        label: cell.label,\n        grading: rewriteGradingLutSrc(cell.grading, stagedName),\n      };\n    });\n\n    const html = buildGradeCompareHtml({\n      cells: stagedCells,\n      frameSrc: frameFileName,\n      frameWidth: opts.frameWidth,\n      frameHeight: opts.frameHeight,","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/grade-compare.ts#L431-L467","documentation":"Thrown by prepareGradeCompareTempProject when a LUT file exists and was read, but failed validation by `parseCubeLut(lutText, { maxSize: 64 })`. The .cube parser enforces the standard format and a 64-entry size cap; a corrupt, truncated, oversized, or non-.cube file is rejected before staging so the render doesn't fail later in the browser with an opaque shader error.","triggerScenarios":"A .cube file that is malformed (bad header, wrong line counts, non-numeric rows), exceeds 64 grid points, is actually a different format with a .cube extension, or was truncated by a bad download/git checkout.","commonSituations":"Downloading a 1D LUT and renaming to .cube; a text-mode FTP/git operation that mangled line endings or truncated the file; a LUT exported at 65+ points (the cap is 64); copy-paste introducing stray characters.","solutions":["Open the named .cube file and verify it is a valid 3D .cube LUT with a LUT_3D_SIZE line ≤ 64.","Re-export or re-download the LUT from its source in binary mode.","If the LUT is genuinely larger than 64 points, downsample it with a LUT tool — HyperFrames will not raise the cap.","Check the inner error message (appended after the colon) for the specific parse failure."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate a .cube file out-of-band before grading\nimport { parseCubeLut } from \"@hyperframes/core\";\nimport { readFileSync } from \"node:fs\";\nfunction assertValidCube(path: string): void {\n  const text = readFileSync(path, \"utf-8\");\n  parseCubeLut(text, { maxSize: 64 }); // throws on invalid\n}","typeGuard":null,"tryCatchPattern":"try {\n  await prepareGradeCompareTempProject(opts);\n} catch (err) {\n  if (/not a valid .cube/.test((err as Error).message))) {\n    // re-derive or replace the offending LUT; message names the cell + inner cause\n  }\n  throw err;\n}","preventionTips":["Re-download LUTs in binary mode to avoid line-ending/truncation corruption.","Keep LUTs at LUT_3D_SIZE ≤ 64; downsample larger ones externally.","Add a pre-commit hook that runs parseCubeLut on every .cube file."],"tags":["cli","luts","validation","grade-compare","parsing"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}