remotion-dev/remotion · error · TypeError

Invalid LUT content on line

Error message

Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE may only be declared once

What it means

LUT_3D_SIZE defines the grid dimension of a 3D LUT and may appear only once per file. parseCubeLut() throws this TypeError when a second LUT_3D_SIZE directive is found, because a single LUT cannot have two grid sizes.

Solutions

  1. Delete the extra LUT_3D_SIZE line, keeping the one matching the actual number of color rows (rows must equal size^3)
  2. Fix the existing LUT_3D_SIZE value in place instead of adding a second declaration
  3. Re-export the LUT with a single correct size

Example fix

// before
LUT_3D_SIZE 2
LUT_3D_SIZE 32
...color rows...
// after
LUT_3D_SIZE 32
...color rows...
Defensive patterns

Strategy: validation

Validate before calling

const sizes = content.split(/\r?\n/).filter((l) => l.trim().startsWith('LUT_3D_SIZE'));
if (sizes.length !== 1) throw new Error(`Expected exactly one LUT_3D_SIZE, got ${sizes.length}`);

Type guard

null

Try / catch

try {
  const lut = parseCubeLut(content);
} catch (e) {
  if (e instanceof TypeError && e.message.includes('LUT_3D_SIZE may only be declared once')) {
    // strip duplicate size lines and retry
  } else throw e;
}

Prevention

When it happens

Trigger: parseCubeLut() is given content with two LUT_3D_SIZE lines, e.g. 'LUT_3D_SIZE 2' and later 'LUT_3D_SIZE 32'.

Common situations: Merged or concatenated LUT files, hand-edited files where the size was changed by adding a new line instead of editing the old one.

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

Appendix: source

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

				throw new TypeError(
					`Invalid LUT content on line ${lineNumber}: ${keyword} must appear before the color data`,
				);
			}

			if (keyword === 'TITLE') {
				if (hasTitle) {
					throw new TypeError(
						`Invalid LUT content on line ${lineNumber}: TITLE may only be declared once`,
					);
				}

				hasTitle = true;
				continue;
			}

			if (keyword === 'LUT_3D_SIZE') {
				if (size !== null) {
					throw new TypeError(
						`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE may only be declared once`,
					);
				}

				if (values.length !== 1) {
					throw new TypeError(
						`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must contain exactly one integer`,
					);
				}

				const parsedSize = Number(values[0]);
				if (
					!Number.isInteger(parsedSize) ||
					parsedSize < 2 ||
					parsedSize > 256
				) {
					throw new TypeError(
						`Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must be an integer from 2 to 256`,

View on GitHub (pinned to 46a3a6bf13)