remotion-dev/remotion · error · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
Zigzag links its compiled shaders into a program via gl.createProgram; a null return means the GL context would not allocate the program object, so the effect throws before linking. Both shaders already compiled, so this is a context/resource allocation failure (lost context, program-object limit, software renderer), independent of parameters.
Source
Thrown at packages/effects/src/zigzag.ts:370
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(`Zigzag shader compile failed: ${log ?? '(no log)'}`);
}
return shader;
};
const linkProgram = (
gl: WebGL2RenderingContext,
vs: WebGLShader,
fs: WebGLShader,
): WebGLProgram => {
const program = gl.createProgram();
if (!program) {
throw new Error('Failed to create WebGL program');
}
gl.attachShader(program, vs);
gl.attachShader(program, fs);
gl.linkProgram(program);
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
const log = gl.getProgramInfoLog(program);
gl.deleteProgram(program);
throw new Error(`Zigzag program link failed: ${log ?? '(no log)'}`);
}
return program;
};
const createProgram = (
gl: WebGL2RenderingContext,
vertexSource: string,
fragmentSource: string,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Verify WebGL2 context health (non-null getContext('webgl2'), isContextLost() false) before rendering.
- Use Remotion's bundled Chrome for headless rendering; avoid disabling the software GPU.
- Reduce simultaneously-active WebGL effects to free program-object slots.
- Recreate the composition on webglcontextlost so setup re-runs cleanly.
- Update GPU drivers or move to a host with a fully conformant WebGL2 implementation.
Defensive patterns
Strategy: try-catch
Validate before calling
const gl = document.createElement('canvas').getContext('webgl2');
const webglOk = gl != null && gl.createProgram() != null && !gl.isContextLost(); Type guard
const canCreateProgram = (): boolean => {
const gl = document.createElement('canvas').getContext('webgl2');
return gl != null && !gl.isContextLost() && gl.createProgram() != null;
}; Try / catch
try {
return <VideoEffects effects={[zigzag({colors: ['#ff0000', '#00ff00']})]} />;
} catch (err) {
if (err instanceof Error && err.message === 'Failed to create WebGL program') {
return <Video />;
}
throw err;
} Prevention
- Probe program-object allocation before mounting zigzag().
- Render with Remotion's bundled Chromium; avoid disabling the GPU.
- Reduce concurrent WebGL effects to free program slots.
- Re-mount on webglcontextlost.
When it happens
Trigger: linkProgram in zigzag.ts: gl.createProgram() returns null after the vertex and fragment shaders compiled successfully.
Common situations: Context lost between compile and program create; too many programs alive across many concurrent effects; headless renderer with incomplete WebGL2 program allocation; GPU memory pressure.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL shader
- Failed to create program
- Failed to create WebGL texture
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/c6d9d602409dbc2c.
Report an issue: GitHub.