{"record":{"id":"348077faac919430","repo":"heygen-com/hyperframes","slug":"invalid-color-grading-for-cell-label","errorCode":null,"errorMessage":"Invalid color grading for cell \"${label}\"","messagePattern":"Invalid color grading for cell \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/grade-compare.ts","lineNumber":135,"sourceCode":"  return value\n    .replace(/&/g, \"&amp;\")\n    .replace(/</g, \"&lt;\")\n    .replace(/>/g, \"&gt;\")\n    .replace(/\"/g, \"&quot;\")\n    .replace(/'/g, \"&apos;\");\n}\n\nfunction escapeSingleQuotedAttr(value: string): string {\n  return value\n    .replace(/&/g, \"&amp;\")\n    .replace(/</g, \"&lt;\")\n    .replace(/>/g, \"&gt;\")\n    .replace(/'/g, \"&#39;\");\n}\n\nfunction validateCell(label: string, grading: unknown): GradeCompareCell {\n  if (!normalizeHfColorGrading(grading)) {\n    throw new Error(`Invalid color grading for cell \"${label}\"`);\n  }\n  return { label, grading };\n}\n\nexport function warnInactiveGradingCells(cells: readonly GradeCompareCell[]): void {\n  for (const cell of cells) {\n    const normalized = normalizeHfColorGrading(cell.grading);\n    if (!isHfColorGradingActive(normalized)) {\n      console.error(\n        c.warn(`Warning: grading for \"${cell.label}\" is inactive/no-op — it will render ungraded`),\n      );\n    }\n  }\n}\n\nexport function capCandidateCells(cells: readonly GradeCompareCell[]): CandidateCellCapResult {\n  const total = cells.length;\n  if (total <= MAX_CANDIDATE_CELLS) {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/commands/grade-compare.ts#L117-L153","documentation":"Thrown by validateCell() in grade-compare when normalizeHfColorGrading(grading) returns null. normalize returns null when readColorGradingObject yields nothing — empty/whitespace string, a malformed JSON string not starting with '{', a non-object primitive (number, null, undefined), an array, or an object with enabled:false. Note: a bare object {} is VALID (it normalizes to an inactive baseline) — only enabled:false or unparseable shapes are rejected.","triggerScenarios":"A grades.json entry with grading: null, \"\", 42, [], \"{bad json\", or { enabled: false }; passing undefined where a grading object is expected.","commonSituations":"Hand-writing grades.json and using null/empty as a placeholder; copying a grading snippet that had enabled:false; a schema drift after a library version change.","solutions":["Make grading an object — even {} is valid (renders as the inactive baseline)","Use a preset name string, e.g. \"cinematic\", which readColorGradingObject accepts","Remove enabled:false (or set it to true) so normalize does not short-circuit to null"],"exampleFix":"// before\n[\n  { \"label\": \"warm\", \"grading\": null }\n]\n// after\n[\n  { \"label\": \"warm\", \"grading\": {} }\n]\n// or\n[\n  { \"label\": \"warm\", \"grading\": \"cinematic\" }\n]","handlingStrategy":"type-guard","validationCode":"import { normalizeHfColorGrading } from '@hyperframes/core';\nif (!normalizeHfColorGrading(grading)) {\n  throw new Error(`grading for ${label} is invalid (use an object, a preset name, or remove enabled:false)`);\n}","typeGuard":"import { normalizeHfColorGrading } from '@hyperframes/core';\nfunction isValidGrading(grading: unknown): boolean {\n  return normalizeHfColorGrading(grading) !== null;\n}","tryCatchPattern":null,"preventionTips":["Use {} for an inactive baseline — it is valid; only enabled:false is rejected","Validate every grading with normalizeHfColorGrading before building cells","Prefer preset-name strings or well-formed objects from the docs"],"tags":["color-grading","validation","grade-compare","normalize"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}