remotion-dev/remotion · error
Invalid LUT color on line
Error message
Invalid LUT color on line ${index + 1}. What it means
Every data line in a .cube file must be exactly three finite numbers (r g b). parseCubeLut builds a color from the first token plus the remaining tokens and throws this error when the line does not yield exactly 3 values, or any value is not finite after Math.fround (NaN, Infinity, or non-numeric tokens). The 1-based line number is included so the broken row can be located quickly.
Solutions
- Fix the reported line to contain exactly three whitespace-separated finite decimal numbers.
- Replace comma decimal separators with dots and remove any thousands separators.
- Delete extra columns (e.g. alpha or index) so only r g b remain.
- Re-export the LUT from the source application.
- Pre-validate each data line with a regex like /^[\d.eE+-.]+\s+[\d.eE+-.]+\s+[\d.eE+-.]+$/ before calling parseCubeLut.
Example fix
// before (comma decimals) 0,5 0,5 0,5 // after 0.5 0.5 0.5
Defensive patterns
Strategy: validation
Validate before calling
const isColorLine = (line: string): boolean => {
const parts = line.trim().split(/\s+/);
return parts.length === 3 && parts.every((p) => Number.isFinite(Number(p)));
}; Try / catch
try {
const lut = parseCubeLut(text);
} catch (e) {
const m = /line (\d+)/.exec((e as Error).message);
if (m) console.error(`Bad color row at line ${m[1]}`);
} Prevention
- Use dots, not commas, as decimal separators in .cube data
- Keep exactly three whitespace-separated columns per data line
- Re-export rather than hand-editing color tables
When it happens
Trigger: parseCubeLut(text) with a data line like '0.5 0.5' (two values), 'r g b' (non-numeric tokens that slipped past the header regex, e.g. lowercase), '1 2 3 4' (four values), or containing NaN/Infinity values.
Common situations: CSV-exported data pasted into .cube files; files with tab/comma separators where split(/\s+/) still works but one field is empty; locale-formatted numbers ('0,5 0,5 0,5') that Number() turns into NaN; extra alpha channel column.
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
- Combined 1D and 3D LUTs are not supported.
- Duplicate on line .
- Expected LUT colors, got more.
- Expected LUT colors, got .
- Expected LUT_1D_SIZE or LUT_3D_SIZE.
AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18).
Data as JSON: /api/errors/c4e98b08657e071c.
Report an issue: GitHub.
Appendix: source
Thrown at packages/studio/src/helpers/cube-lut.ts:114
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;
}
if (type === null || data === null) {
throw new Error('Expected LUT_1D_SIZE or LUT_3D_SIZE.');
}
if (offset !== data.length) {
throw new Error(
`Expected ${data.length / 3} LUT colors, got ${offset / 3}.`,
);View on GitHub (pinned to 46a3a6bf13)