remotion-dev/remotion · error
Failed to create LUT shader
Error message
Failed to create LUT shader
What it means
During WebGL2 shader creation for the LUT effect, gl.createShader() returned null, meaning the browser could not allocate a shader object. This is a hard WebGL resource-allocation failure, not a shader-source problem (compile errors throw a different message, error 18). It surfaces while setting up the lut() effect on a canvas.
Solutions
- Listen for 'webglcontextlost' on the canvas and retry rendering once the context is restored (webglcontextrestored).
- Reduce the number of simultaneously live WebGL contexts/canvases on the page (release contexts, use fewer concurrent effects).
- Restart the render / reload the page to get a fresh GPU context.
- Test in a different browser or with hardware acceleration enabled to rule out a driver/software-GL issue.
Defensive patterns
Strategy: retry
Validate before calling
const gl = canvas.getContext('webgl2');
if (!gl) throw new Error('WebGL2 unavailable — LUT effect cannot run');
canvas.addEventListener('webglcontextlost', (e) => { e.preventDefault(); /* mark for retry */ }); Try / catch
try {
setupEffectWithLut(canvas);
} catch (e) {
if (e instanceof Error && e.message === 'Failed to create LUT shader') {
// context lost or GPU resources exhausted: wait for webglcontextrestored, then retry once
} else throw e;
} Prevention
- Keep live WebGL context count low (browsers cap around 16)
- Handle webglcontextlost/webglcontextrestored events on render canvases
- Verify hardware acceleration is enabled in the rendering browser
- Release old canvases/effects explicitly before creating new ones
When it happens
Trigger: Calling setupLut when the WebGL2 context has been lost (webglcontextlost) or is otherwise exhausted; the GPU context having too many live shader objects; a driver/browser failure to allocate. Any lut() effect setup on a canvas whose context is in a lost state.
Common situations: Rendering many compositions/effects that exhaust GPU resources (e.g. Chrome's ~16 live WebGL contexts per page); headless rendering with software GL under memory pressure; context loss after the machine suspends or the GPU resets.
Related errors
- Failed to create LUT shader program
- Failed to create program
- Failed to create program
- Failed to create shader
- Failed to create vibrance shader
AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18).
Data as JSON: /api/errors/bfb33dbeff1b63eb.
Report an issue: GitHub.
Appendix: source
Thrown at packages/effects/src/lut/lut-runtime.ts:31
readonly lutTexture: WebGLTexture;
readonly uniforms: {
readonly uSource: WebGLUniformLocation | null;
readonly uLut: WebGLUniformLocation | null;
readonly uLutSize: WebGLUniformLocation | null;
readonly uDomainMin: WebGLUniformLocation | null;
readonly uDomainMax: WebGLUniformLocation | null;
};
cachedContent: string | null;
};
const compileShader = (
gl: WebGL2RenderingContext,
type: number,
source: string,
): WebGLShader => {
const shader = gl.createShader(type);
if (!shader) {
throw new Error('Failed to create LUT shader');
}
gl.shaderSource(shader, source);
gl.compileShader(shader);
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
const log = gl.getShaderInfoLog(shader);
gl.deleteShader(shader);
throw new Error(`LUT shader compile failed: ${log ?? '(no log)'}`);
}
return shader;
};
const createProgram = (gl: WebGL2RenderingContext): WebGLProgram => {
const vertexShader = compileShader(gl, gl.VERTEX_SHADER, LUT_VERTEX_SHADER);
const fragmentShader = compileShader(
gl,
gl.FRAGMENT_SHADER,View on GitHub (pinned to 46a3a6bf13)