{"record":{"id":"215a6dc4d961d9a8","repo":"heygen-com/hyperframes","slug":"keyword-expects-a-size","errorCode":null,"errorMessage":"${keyword} expects a size","messagePattern":"(.+?) expects a size","errorType":"validation","errorClass":"CubeLutParseError","httpStatus":null,"severity":"error","filePath":"packages/core/src/colorLuts.ts","lineNumber":65,"sourceCode":"  if (!Number.isFinite(parsed)) {\n    throw new CubeLutParseError(`Invalid number \"${value}\"`, lineNumber);\n  }\n  return parsed;\n}\n\nfunction parseVec3(parts: string[], keyword: string, lineNumber: number): CubeLutVec3 {\n  if (parts.length !== 3) {\n    throw new CubeLutParseError(`${keyword} expects three numbers`, lineNumber);\n  }\n  return [\n    parseFiniteNumber(parts[0]!, lineNumber),\n    parseFiniteNumber(parts[1]!, lineNumber),\n    parseFiniteNumber(parts[2]!, lineNumber),\n  ];\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 {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/core/src/colorLuts.ts#L47-L83","documentation":"parseSize rejects an empty or missing size argument on LUT_1D_SIZE / LUT_3D_SIZE. The throw at line 65 fires before numeric parsing, when rest[0] is undefined or the empty string.","triggerScenarios":"A header line 'LUT_3D_SIZE' with no following number, or a line whose only token is the keyword (rest is empty).","commonSituations":"Truncated header from a partial file write; a hand-authored template missing the size value; a stray newline splitting keyword from its argument.","solutions":["Add the integer size after the keyword, e.g. 'LUT_3D_SIZE 32'.","Re-export the LUT — size is mandatory metadata that the source tool always emits.","If generating LUTs programmatically, assert the size field is set before serialization."],"exampleFix":"// before\nLUT_3D_SIZE\n\n// after\nLUT_3D_SIZE 32","handlingStrategy":"try-catch","validationCode":"function assertSizePresent(line: string): void {\n  const parts = line.trim().split(/\\s+/);\n  const keyword = (parts[0] ?? '').toUpperCase();\n  if ((keyword === 'LUT_1D_SIZE' || keyword === 'LUT_3D_SIZE') && !parts[1]) {\n    throw new Error(`${keyword} requires a size argument`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseCubeLut(fileText);\n} catch (err) {\n  if (err instanceof CubeLutParseError && /expects a size/.test(err.message)) {\n    // prompt user for the missing size, or re-export\n  } else throw err;\n}","preventionTips":["Always write the integer size on the LUT_*_SIZE line.","Assert headers programmatically when generating LUTs.","Re-export from the source tool, which always emits the size."],"tags":["lut","cube","parsing","size"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}