remotion-dev/remotion · critical · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
While linking the mirror effect's compiled shaders into a WebGL program, gl.createProgram() returned null. The WebGL2 context is available but cannot allocate a new program object, typically due to context loss or severe GPU resource exhaustion.
Source
Thrown at packages/effects/src/mirror/mirror-runtime.ts:50
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
- Reduce the number of concurrent WebGL effects being set up.
- Ensure a healthy WebGL2 context — check for context loss and retry after the context is restored.
- Use a more capable GPU or updated drivers in the render environment.
- For headless rendering, verify the Chrome/GPU configuration supports program allocation.
Defensive patterns
Strategy: try-catch
Try / catch
try {
// apply mirror effect
} catch (e) {
if (e instanceof Error && e.message.includes('WebGL program')) {
console.warn('WebGL program creation failed, falling back without mirror');
// fallback rendering path
} else {
throw e;
}
} Prevention
- Reduce the number of concurrent WebGL effects to avoid program allocation limits.
- Handle WebGL context loss and retry rendering.
- Ensure adequate GPU resources in the render environment.
When it happens
Trigger: During setupMirror, linkProgram calls gl.createProgram() which returns null. This occurs after shaders have already compiled successfully, indicating the context can compile shaders but cannot create program objects.
Common situations: Context loss mid-setup; GPU memory exhaustion from too many simultaneous WebGL programs; driver bugs under heavy load; headless environments with marginal WebGL2 support.
Related errors
- Failed to create WebGL texture
- Failed to create WebGL vertex array
- Failed to create WebGL buffer
- Failed to create WebGL shader
- Failed to create WebGL program
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/73326850465309e3.
Report an issue: GitHub.