remotion-dev/remotion · error

must be an integer from 2 to .

Error message

${keyword} must be an integer from 2 to ${maxSize}.

What it means

The LUT_1D_SIZE or LUT_3D_SIZE keyword must have exactly one integer value within allowed bounds (1D: 2–65536, 3D: 2–256). parseCubeLut throws when the value is missing, non-numeric, fractional, or out of range.

Solutions

  1. Set the size line to a single valid integer (2–256 for LUT_3D_SIZE, 2–65536 for LUT_1D_SIZE).
  2. Regenerate the LUT data to match the declared size, or change the size to match the data.
  3. Re-export the LUT from its tool with a standard size (e.g. 33 for 3D).
  4. Fix truncated lines in the file if the value was cut off.

Example fix

// before
LUT_3D_SIZE 1024
// after
LUT_3D_SIZE 256
Defensive patterns

Strategy: validation

Validate before calling

const m = text.match(/^LUT_(1D|3D)_SIZE\s+(\S+)/m);
const limits = {'1D': 65536, '3D': 256};
if (!m || !Number.isInteger(+m[2]) || +m[2] < 2 || +m[2] > limits[m[1]]) throw new Error(`Invalid ${m?.[0] ?? 'size'}`);

Type guard

null

Try / catch

try {
  parseCubeLut(text);
} catch (err) {
  if (err.message.includes('must be an integer from 2 to')) {
    // show size constraints to user
  }
}

Prevention

When it happens

Trigger: Loading a .cube file whose size line is like 'LUT_3D_SIZE' (no value), 'LUT_3D_SIZE 2.5', 'LUT_3D_SIZE 0', or 'LUT_3D_SIZE 1024' (exceeds the 3D max of 256).

Common situations: Corrupted or truncated header lines; LUTs from tools using non-standard sizes; typos in hand-edited files.

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

Appendix: source

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

			title = titleMatch[1];
			continue;
		}

		if (keyword === 'LUT_1D_SIZE' || keyword === 'LUT_3D_SIZE') {
			if (type !== null) {
				throw new Error('Combined 1D and 3D LUTs are not supported.');
			}

			type = keyword === 'LUT_1D_SIZE' ? '1d' : '3d';
			size = numbers[0];
			const maxSize = type === '1d' ? 65536 : 256;
			if (
				numbers.length !== 1 ||
				!Number.isInteger(size) ||
				size < 2 ||
				size > maxSize
			) {
				throw new Error(`${keyword} must be an integer from 2 to ${maxSize}.`);
			}

			data = new Float32Array((type === '1d' ? size : size ** 3) * 3);
			continue;
		}

		if (keyword === 'DOMAIN_MIN' || keyword === 'DOMAIN_MAX') {
			if (numbers.length !== 3 || !numbers.every(Number.isFinite)) {
				throw new Error(`${keyword} must contain three finite numbers.`);
			}

			if (keyword === 'DOMAIN_MIN') {
				domainMin = [numbers[0], numbers[1], numbers[2]];
			} else {
				domainMax = [numbers[0], numbers[1], numbers[2]];
			}

			continue;

View on GitHub (pinned to 46a3a6bf13)