remotion-dev/remotion · error · TypeError

Invalid LUT content on line

Error message

Invalid LUT content on line ${lineNumber}: LUT_3D_SIZE must be an integer from 2 to 256

What it means

parseCubeLut() only accepts a LUT_3D_SIZE value that is an integer between 2 and 256 inclusive. Non-integers, values below 2 (a 1x1x1 grid is not a real LUT), and values above 256 are rejected to keep memory use and parsing sane.

Solutions

  1. Resample/downgrade the LUT to a size of 256 or below using a LUT tool (e.g. export at 32/64)
  2. Correct the value to a valid integer between 2 and 256 whose cube equals your color-row count
  3. Check whether your exporter has a resolution setting that exceeds 256 and lower it

Example fix

// before
LUT_3D_SIZE 512
// after
LUT_3D_SIZE 256
Defensive patterns

Strategy: validation

Validate before calling

const m = content.match(/^LUT_3D_SIZE\s+(\d+)\s*$/m);
if (!m) throw new Error('Missing LUT_3D_SIZE');
const size = Number(m[1]);
if (!Number.isInteger(size) || size < 2 || size > 256) throw new Error(`Size ${size} out of range 2-256`);

Type guard

null

Try / catch

try {
  const lut = parseCubeLut(content);
} catch (e) {
  if (e instanceof TypeError && e.message.includes('must be an integer from 2 to 256')) {
    // resample the LUT to an allowed size, e.g. 32 or 64
  } else throw e;
}

Prevention

When it happens

Trigger: A .cube file declares e.g. 'LUT_3D_SIZE 1', 'LUT_3D_SIZE 0', 'LUT_3D_SIZE 512', 'LUT_3D_SIZE 33.5', or a non-numeric token like 'LUT_3D_SIZE auto'.

Common situations: Very high-resolution LUTs exported above the 256 limit, corrupted or placeholder size values, fractional sizes from a misconfigured exporter.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

				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`,
					);
				}

				size = parsedSize;
				continue;
			}

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

				domainMin = parseTriplet({
					values,
					lineNumber,

View on GitHub (pinned to 46a3a6bf13)