remotion-dev/remotion · error · TypeError

Invalid LUT content on line

Error message

Invalid LUT content on line ${lineNumber}: ${label} must contain exactly 3 numbers

What it means

parseTriplet() is used by parseCubeLut to convert each RGB data line of a .cube file into a [red, green, blue] tuple. When a data line does not split into exactly 3 whitespace-separated numbers, a TypeError is thrown identifying the line number and the label (e.g. the LUT_3D_SIZE directive or a data row). .cube data rows must always contain exactly R G B values.

Solutions

  1. Open the .cube file at the reported line number and fix or remove the malformed row
  2. Re-export the LUT from the original grading tool in standard .cube format
  3. Replace commas with spaces and ensure values are space-separated
  4. Validate the file with a .cube linter/parser before passing it to the effect

Example fix

// before: comma-separated values inside the .cube file
0.1,0.2,0.3
// after: standard .cube data line (3 space-separated numbers)
0.1 0.2 0.3
Defensive patterns

Strategy: validation

Validate before calling

const dataLines = cubeText.split('\n').filter((l) => l && !l.startsWith('#') && /^\s*[\d.-]/.test(l));
const bad = dataLines.findIndex((l) => l.trim().split(/\s+/).length !== 3);
if (bad !== -1) {
  throw new Error(`.cube data line ${bad + 1} does not have exactly 3 numbers`);
}

Try / catch

try {
  const lut = parseCubeLut(cubeText);
} catch (e) {
  if (e instanceof TypeError && e.message.includes('must contain exactly 3 numbers')) {
    // surface e.message (includes line number) to the user for fixing the .cube file
  }
}

Prevention

When it happens

Trigger: A .cube file with malformed data rows: extra values per line (e.g. RGB+alpha), values merged without whitespace ('0.50.5 0.5 0.5'), comma-separated values ('0.1,0.2,0.3'), or lines with only one or two columns.

Common situations: Hand-edited or truncated .cube files; LUTs exported from tools using a locale-dependent decimal comma; copy-paste corruption turning tabs/newlines into odd whitespace; files with a trailing label line misread as data.

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/efa9c03d411e7e7f. Report an issue: GitHub.

Appendix: source

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

		} else if (character === '#' && !insideQuotes) {
			return line.slice(0, i);
		}
	}

	return line;
};

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',

View on GitHub (pinned to 46a3a6bf13)