remotion-dev/remotion · critical · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
After successfully compiling both vertex and fragment shaders, the effect calls gl.createProgram() to allocate a linked GPU program object. If the WebGL2 context returns null, the effect cannot proceed with linking and throws immediately. A null return signals that the GL context is lost, exhausted, or already destroyed.
Source
Thrown at packages/effects/src/radial-progressive-blur/radial-progressive-blur-runtime.ts:65
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
const log = gl.getShaderInfoLog(shader);
gl.deleteShader(shader);
throw new Error(
`Radial progressive blur 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(
`Radial progressive blur program link failed: ${log ?? '(no log)'}`,
);
}
return program;
};
const createProgram = (
gl: WebGL2RenderingContext,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Listen for the 'webglcontextlost' event on the canvas and reinitialize effects after 'webglcontextrestored'
- Reduce the number of simultaneous WebGL effects in the composition
- Ensure the render is running on a machine with a stable GPU context (not a headless environment with a fragile software rasterizer)
- Retry the effect setup after context restoration
Defensive patterns
Strategy: try-catch
Try / catch
canvas.addEventListener('webglcontextlost', (e) => { e.preventDefault(); }, false);
canvas.addEventListener('webglcontextrestored', () => {
// re-initialize all WebGL effects here
}, false); Prevention
- Always register webglcontextlost and webglcontextrestored handlers on the rendering canvas
- Limit the number of simultaneous WebGL effects to stay within GPU resource pools
- Dispose of effects and their GL resources when they are removed from the composition
When it happens
Trigger: Calling setupRadialProgressiveBlur() when the WebGL2 context has been lost (e.g. after a GPU process crash or tab backgrounding on mobile), when the context's resource pool is exhausted, or when the context was externally destroyed between shader compilation and program creation.
Common situations: Mobile browsers that aggressively reclaim GPU memory; long-running renders with many simultaneous effects that exhaust GL object pools; switching GPU (hybrid laptops) mid-session; background tabs on power-constrained devices.
Related errors
- Failed to create WebGL texture
- Failed to create WebGL vertex array
- Failed to create WebGL buffer
- Failed to create WebGL framebuffer
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/325a927b5b5ab50d.
Report an issue: GitHub.