heygen-com/hyperframes · error · CubeLutParseError
Invalid number "${value}"
Error message
Invalid number "${value}" What it means
parseFiniteNumber converts a .cube token to a JS number and rejects anything that is not finite (NaN, Infinity, or non-numeric text). It is the shared numeric coercion for DOMAIN_MIN/MAX, LUT_3D_INPUT_RANGE, and data-row channels. The error echoes the offending token so you can locate it.
Source
Thrown at packages/core/src/colorLuts.ts:48
const DEFAULT_DOMAIN_MIN: CubeLutVec3 = [0, 0, 0];
const DEFAULT_DOMAIN_MAX: CubeLutVec3 = [1, 1, 1];
export const DEFAULT_MAX_CUBE_LUT_SIZE = 64;
function stripComment(line: string): string {
let inQuote = false;
for (let i = 0; i < line.length; i++) {
const char = line[i];
if (char === '"') inQuote = !inQuote;
if (char === "#" && !inQuote) return line.slice(0, i);
}
return line;
}
function parseFiniteNumber(value: string, lineNumber: number): number {
const parsed = Number(value);
if (!Number.isFinite(parsed)) {
throw new CubeLutParseError(`Invalid number "${value}"`, lineNumber);
}
return parsed;
}
function parseVec3(parts: string[], keyword: string, lineNumber: number): CubeLutVec3 {
if (parts.length !== 3) {
throw new CubeLutParseError(`${keyword} expects three numbers`, lineNumber);
}
return [
parseFiniteNumber(parts[0]!, lineNumber),
parseFiniteNumber(parts[1]!, lineNumber),
parseFiniteNumber(parts[2]!, lineNumber),
];
}
function parseSize(value: string | undefined, keyword: string, lineNumber: number): number {
if (!value) throw new CubeLutParseError(`${keyword} expects a size`, lineNumber);
const parsed = Number(value);View on GitHub (pinned to c2996c8626)
Solutions
- Open the file at the reported line and inspect the offending token quoted in the message.
- If the file uses comma decimals, re-export with a period as the decimal separator.
- Strip non-numeric bytes / fix encoding before calling parseCubeLut.
- Re-download or re-export the LUT from the source tool.
Example fix
// before — file contains: 0.10 0,5 0.30 (comma decimal) parseCubeLut(fileText); // after — normalize decimal separators parseCubeLut(fileText.replace(/,(?=\d)/g, '.'));
Defensive patterns
Strategy: try-catch
Validate before calling
function tryFinite(value: string): number | null {
const n = Number(value);
return Number.isFinite(n) ? n : null;
}
// pre-scan tokens before parseCubeLut
for (const tok of allNumericTokens(fileText)) {
if (tryFinite(tok) === null) throw new Error(`Bad numeric token: ${tok}`);
} Try / catch
import { CubeLutParseError } from '@hyperframes/core';
try {
const lut = parseCubeLut(fileText);
} catch (err) {
if (err instanceof CubeLutParseError) {
console.error(`LUT parse failed at line ${err.lineNumber}: ${err.message}`);
// surface to user, fall back to an identity LUT, or re-export
}
throw err;
} Prevention
- Treat .cube files as untrusted input — wrap parseCubeLut in try/catch on CubeLutParseError.
- Re-export LUTs from the source tool rather than hand-editing numeric data.
- Normalize decimal separators (comma -> period) before parsing locale-formatted files.
When it happens
Trigger: A .cube file containing a non-numeric token where a number is expected: e.g. a data row like '0.1 abc 0.3', a DOMAIN_MIN line with text, or a token that Number() parses to NaN.
Common situations: Corrupted or truncated download; locale-formatted file using a comma as decimal separator; stray BOM or non-breaking space inside a value; a comment marker inside a quoted title leaking into numeric context.
Related errors
- ${keyword} expects three numbers
- ${keyword} expects a size
- ${keyword} must be an integer greater than 1
- DOMAIN_MAX values must be greater than DOMAIN_MIN values
- ${keyword} expects two numbers
AI-assisted analysis of heygen-com/hyperframes@c2996c8626 (2026-08-12).
Data as JSON: /api/errors/2972f4bacfa51ebf.
Report an issue: GitHub.