remotion-dev/remotion · critical · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
Thrown by the blur effect's `linkProgram` helper when `gl.createProgram()` returns `null`. This is a resource-allocation failure: the GL implementation could not create another program object. Distinct from a link failure (which happens after linking); here the program handle was never allocated.
Source
Thrown at packages/effects/src/blur/blur-runtime.ts:59
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(`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(`Program link failed: ${log ?? '(no log)'}`);
}
return program;
};
const createProgram = (
gl: WebGL2RenderingContext,
vertexSource: string,
fragmentSource: string,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Guard with `gl.isContextLost()` and reinitialize on restoration.
- Free unused blur states via `cleanupBlur` (deletes both programs).
- Reduce the number of concurrently active WebGL effects.
- Ensure hardware-accelerated WebGL2; update drivers.
Example fix
if (gl.isContextLost()) {
// reinitialize after webglcontextrestored
} else {
const state = setupBlur(canvas);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (gl.isContextLost()) { /* skip setupBlur */ } Try / catch
try {
const state = setupBlur(canvas);
} catch (err) {
if (/Failed to create WebGL program/.test(err.message)) {
// await restore or reduce effects, then retry
} else { throw err; }
} Prevention
- Release programs via cleanupBlur on unused states.
- Handle context-loss events.
- Limit concurrent effects.
When it happens
Trigger: Fires at line 58-59 inside `linkProgram`, called from `createProgram` for the horizontal and vertical blur programs. Occurs when `gl.createProgram()` yields null.
Common situations: Context loss during blur setup; program-object cap exhausted by many live effects; software renderer with low limits.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL vertex array
- Failed to create WebGL buffer
- Failed to create WebGL framebuffer
- Failed to create WebGL program
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/322ddf18fe12cbb4.
Report an issue: GitHub.