remotion-dev/remotion · error · TypeError

Invalid LUT content on line

Error message

Invalid LUT content on line ${lineNumber}: ${label} must contain only finite numbers

What it means

parseTriplet() maps each of the 3 values with Number() and throws a TypeError if any result is not finite (NaN, Infinity, -Infinity). A .cube data row must consist of parseable numeric literals, so values like 'abc', empty strings, or overflowing numbers make the whole LUT invalid.

Solutions

  1. Inspect the reported line number and replace the non-numeric token with a valid decimal value
  2. Re-export the .cube from the grading software rather than hand-editing
  3. Convert localized decimal commas to periods before parsing
  4. Pre-validate the file: every data line must match /^-?\d+(\.\d+)?(e[+-]?\d+)?(\s+-?\d+(\.\d+)?(e[+-]?\d+)?){2}$/i
  5. Verify the downloaded file is text, not an HTML error page

Example fix

// before: bad token in .cube data row
0.1 N/A 0.3
// after: all finite numbers
0.1 0.2 0.3
Defensive patterns

Strategy: validation

Validate before calling

const numRe = /^-?\d*\.?\d+([eE][+-]?\d+)?$/;
const dataLines = cubeText.split('\n').filter((l) => l && !l.startsWith('#') && /^\s*[\d.\-eE+]/.test(l));
const bad = dataLines.findIndex((l) => !l.trim().split(/\s+/).every((v) => numRe.test(v) && Number.isFinite(Number(v))));
if (bad !== -1) {
  throw new Error(`.cube data line ${bad + 1} contains a non-finite value`);
}

Type guard

const isFiniteTriplet = (values: readonly string[]): boolean =>
  values.length === 3 && values.map(Number).every((n) => Number.isFinite(n));

Try / catch

try {
  const lut = parseCubeLut(cubeText);
} catch (e) {
  if (e instanceof TypeError && e.message.includes('must contain only finite numbers')) {
    // e.message contains the line number; fix or remove that row and re-parse
  }
}

Prevention

When it happens

Trigger: A .cube file containing non-numeric tokens in data rows ('N/A', '-', '..'), empty fields from double spaces around a missing value, locale-formatted numbers ('0,5' parsed as invalid), or scientific notation beyond Number range.

Common situations: Corrupted downloads (HTML error pages saved as .cube); files exported with localized decimal commas; manual edits inserting placeholders; truncated files producing empty tokens that Number('') would coerce to 0 but Number(' ') to 0 while 'x' yields NaN.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18). Data as JSON: /api/errors/08033cea1fd7145b. Report an issue: GitHub.

Appendix: source

Thrown at packages/effects/src/lut/parse-cube-lut.ts:40

const parseTriplet = ({
	values,
	lineNumber,
	label,
}: {
	readonly values: readonly string[];
	readonly lineNumber: number;
	readonly label: string;
}): readonly [number, number, number] => {
	if (values.length !== 3) {
		throw new TypeError(
			`Invalid LUT content on line ${lineNumber}: ${label} must contain exactly 3 numbers`,
		);
	}

	const parsed = values.map((value) => Number(value));
	if (parsed.some((value) => !Number.isFinite(value))) {
		throw new TypeError(
			`Invalid LUT content on line ${lineNumber}: ${label} must contain only finite numbers`,
		);
	}

	return [parsed[0], parsed[1], parsed[2]];
};

const HEADER_DIRECTIVES = new Set([
	'TITLE',
	'LUT_3D_SIZE',
	'DOMAIN_MIN',
	'DOMAIN_MAX',
]);

export const parseCubeLut = (content: string): ParsedCubeLut => {
	const lines = content.replace(/^\uFEFF/, '').split(/\r?\n/);
	let size: number | null = null;
	let domainMin: readonly [number, number, number] = [0, 0, 0];

View on GitHub (pinned to 46a3a6bf13)