{"record":{"id":"a9b6b6ab0314078d","repo":"heygen-com/hyperframes","slug":"domain-max-values-must-be-greater-than-domain-min","errorCode":null,"errorMessage":"DOMAIN_MAX values must be greater than DOMAIN_MIN values","messagePattern":"DOMAIN_MAX values must be greater than DOMAIN_MIN values","errorType":"validation","errorClass":"CubeLutParseError","httpStatus":null,"severity":"error","filePath":"packages/core/src/colorLuts.ts","lineNumber":79,"sourceCode":"  ];\n}\n\nfunction parseSize(value: string | undefined, keyword: string, lineNumber: number): number {\n  if (!value) throw new CubeLutParseError(`${keyword} expects a size`, lineNumber);\n  const parsed = Number(value);\n  if (!Number.isInteger(parsed) || parsed < 2) {\n    throw new CubeLutParseError(`${keyword} must be an integer greater than 1`, lineNumber);\n  }\n  return parsed;\n}\n\nfunction validateDomain(domainMin: CubeLutVec3, domainMax: CubeLutVec3): void {\n  if (\n    domainMax[0] <= domainMin[0] ||\n    domainMax[1] <= domainMin[1] ||\n    domainMax[2] <= domainMin[2]\n  ) {\n    throw new CubeLutParseError(\"DOMAIN_MAX values must be greater than DOMAIN_MIN values\");\n  }\n}\n\nfunction parseTitle(line: string): string | null {\n  const quoted = /^TITLE\\s+\"([^\"]*)\"\\s*$/i.exec(line);\n  if (quoted) return quoted[1] ?? null;\n  const bare = /^TITLE\\s+(.+)\\s*$/i.exec(line);\n  return bare ? (bare[1] ?? \"\").trim() || null : null;\n}\n\nfunction isNumericDataLine(token: string): boolean {\n  return /^[+-]?(?:\\d|\\.\\d)/.test(token);\n}\n\n// fallow-ignore-next-line complexity\nexport function parseCubeLut(input: string, options: ParseCubeLutOptions = {}): CubeLut3D {\n  const maxSize = options.maxSize ?? DEFAULT_MAX_CUBE_LUT_SIZE;\n  let title: string | null = null;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/core/src/colorLuts.ts#L61-L97","documentation":"validateDomain rejects any axis where DOMAIN_MAX <= DOMAIN_MIN. The .cube format defines a per-channel input domain that the sampler maps into the LUT; a non-positive range on R, G, or B makes that mapping undefined. The check runs after the full file is parsed (line 179).","triggerScenarios":"DOMAIN_MAX whose any component is <= the matching DOMAIN_MIN component — including equal values, swapped min/max, or a negative range. Note LUT_3D_INPUT_RANGE cannot trip this directly because it pre-checks max > min, but explicit DOMAIN_MIN/DOMAIN_MAX lines can.","commonSituations":"Swapping the DOMAIN_MIN and DOMAIN_MAX lines; setting both to [0,0,0]/[1,1,1] but then overriding only one; an inverted log domain from a mishandled linearization.","solutions":["Ensure every channel of DOMAIN_MAX is strictly greater than the matching DOMAIN_MIN channel.","If you do not need a custom domain, remove both DOMAIN_MIN and DOMAIN_MAX lines — the parser defaults to [0,0,0]..[1,1,1].","Re-export from the source tool, which emits a consistent domain pair."],"exampleFix":"// before\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 0.5 0.5 0.5\n// (or swapped)\nDOMAIN_MIN 1 1 1\nDOMAIN_MAX 0 0 0\n\n// after\nDOMAIN_MIN 0 0 0\nDOMAIN_MAX 1 1 1","handlingStrategy":"try-catch","validationCode":"function assertDomainValid(min: readonly number[], max: readonly number[]): void {\n  if (max[0] <= min[0] || max[1] <= min[1] || max[2] <= min[2]) {\n    throw new Error('DOMAIN_MAX must be > DOMAIN_MIN on every channel');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseCubeLut(fileText);\n} catch (err) {\n  if (err instanceof CubeLutParseError && /DOMAIN_MAX values must be greater/.test(err.message)) {\n    // suggest removing custom domain lines to use the [0,0,0]..[1,1,1] default\n  } else throw err;\n}","preventionTips":["Omit DOMAIN_MIN/DOMAIN_MAX entirely to accept the default [0,0,0]..[1,1,1] domain.","When setting a custom domain, double-check every channel is strictly increasing.","Re-export from the source tool, which emits a consistent pair."],"tags":["lut","cube","domain","parsing"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}