remotion-dev/remotion · error · TypeError

Invalid LUT content: expected

Error message

Invalid LUT content: expected ${maxDataRows} color rows for LUT_3D_SIZE ${size}, but got more

What it means

A LUT_3D_SIZE of N requires exactly N^3 color rows. parseCubeLut() counts rows as it parses and throws this TypeError as soon as more than N^3 data rows appear, preventing silent truncation of extra data.

Solutions

  1. Correct LUT_3D_SIZE to the cube root of the actual color-row count
  2. Trim the extra color rows to match size^3
  3. Re-export the LUT ensuring size and row count agree

Example fix

// before
LUT_3D_SIZE 2
// 64 color rows follow
// after
LUT_3D_SIZE 4
// 64 color rows follow
Defensive patterns

Strategy: validation

Validate before calling

const sizeMatch = content.match(/^LUT_3D_SIZE\s+(\d+)\s*$/m);
const dataRows = content.split(/\r?\n/)
  .map((l) => l.split('#')[0].trim())
  .filter((l) => l && !/^(TITLE|LUT_3D_SIZE|DOMAIN_MIN|DOMAIN_MAX|LUT_1D_SIZE)\b/.test(l)).length;
const size = sizeMatch ? Number(sizeMatch[1]) : null;
if (size && dataRows > size ** 3) throw new Error(`Too many rows: ${dataRows} > ${size ** 3}`);

Type guard

null

Try / catch

try {
  const lut = parseCubeLut(content);
} catch (e) {
  if (e instanceof TypeError && e.message.includes('but got more')) {
    // fix LUT_3D_SIZE to match the row count, or trim extra rows
  } else throw e;
}

Prevention

When it happens

Trigger: parseCubeLut() is given a file whose LUT_3D_SIZE is smaller than the actual number of color rows, e.g. size 2 (expecting 8 rows) with 64 rows of data.

Common situations: Editing the size value down without removing rows, pasting data from a larger LUT into a smaller-header file, or a generator writing the wrong size.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

		}

		if (size === null) {
			throw new TypeError(
				`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must be declared before the color data`,
			);
		}

		parseTriplet({
			values: [keyword, ...values],
			lineNumber,
			label: 'color row',
		});
		dataStarted = true;
		dataRows++;

		const maxDataRows = size ** 3;
		if (dataRows > maxDataRows) {
			throw new TypeError(
				`Invalid LUT content: expected ${maxDataRows} color rows for LUT_3D_SIZE ${size}, but got more`,
			);
		}
	}

	if (size === null) {
		throw new TypeError('Invalid LUT content: LUT_3D_SIZE is missing');
	}

	for (let channel = 0; channel < 3; channel++) {
		if (domainMin[channel] >= domainMax[channel]) {
			throw new TypeError(
				`Invalid LUT content: DOMAIN_MIN must be smaller than DOMAIN_MAX for every channel`,
			);
		}
	}

	const expectedRows = size ** 3;

View on GitHub (pinned to 46a3a6bf13)