remotion-dev/remotion · error

Expected LUT_1D_SIZE or LUT_3D_SIZE before color data.

Error message

Expected LUT_1D_SIZE or LUT_3D_SIZE before color data.

What it means

A .cube file must declare its table size (LUT_1D_SIZE or LUT_3D_SIZE) before any color data lines appear, because the size determines how large the Float32Array backing the table is allocated. parseCubeLut throws this when it encounters a line that is not a recognized header and does not look like one, but no size header has been seen yet, i.e. color data would arrive with no buffer to fill.

Solutions

  1. Add the required size header at the top of the file, e.g. 'LUT_3D_SIZE 33' (or 'LUT_1D_SIZE 32' for 1D LUTs).
  2. Ensure the size header precedes all color data lines in the file.
  3. Re-export the LUT from the original tool; the export is likely corrupted.
  4. In code, pre-validate that the text contains a LUT_1D_SIZE or LUT_3D_SIZE line before the first numeric line.

Example fix

// before
0 0 0
0.03125 0 0
// after
LUT_3D_SIZE 33
0 0 0
0.03125 0 0
Defensive patterns

Strategy: validation

Validate before calling

if (!/(^|\n)\s*LUT_(1D|3D)_SIZE\b/.test(text)) {
  throw new Error('LUT file is missing LUT_1D_SIZE or LUT_3D_SIZE header');
}

Type guard

const hasSizeHeader = (text: string): boolean =>
  /(^|\n)\s*LUT_(1D|3D)_SIZE\b/.test(text);

Try / catch

try {
  const lut = parseCubeLut(text);
} catch (e) {
  alert(`Invalid .cube file: ${(e as Error).message}`);
}

Prevention

When it happens

Trigger: parseCubeLut(text) where the first non-comment, non-empty lines are numeric color triples and the LUT_*_SIZE line is missing, appears after the data, or was dropped by a preprocessing step that stripped headers.

Common situations: Truncated or hand-assembled .cube exports containing only the color table; scripts that concatenate data sections of two files; files where the size header was commented out.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at packages/studio/src/helpers/cube-lut.ts:106

				!numbers.every(Number.isFinite) ||
				numbers[0] >= numbers[1]
			) {
				throw new Error(`${keyword} must contain an increasing input range.`);
			}

			domainMin = [numbers[0], numbers[0], numbers[0]];
			domainMax = [numbers[1], numbers[1], numbers[1]];
			continue;
		}

		if (isHeader) {
			throw new Error(
				`Unsupported LUT header "${keyword}" on line ${index + 1}.`,
			);
		}

		if (data === null) {
			throw new Error('Expected LUT_1D_SIZE or LUT_3D_SIZE before color data.');
		}

		const color = [Number(keyword), ...numbers];
		if (
			color.length !== 3 ||
			!color.every((value) => Number.isFinite(Math.fround(value)))
		) {
			throw new Error(`Invalid LUT color on line ${index + 1}.`);
		}

		if (offset + 3 > data.length) {
			throw new Error(`Expected ${data.length / 3} LUT colors, got more.`);
		}

		data.set(color, offset);
		offset += 3;
	}

View on GitHub (pinned to 46a3a6bf13)