remotion-dev/remotion · critical · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
A plain Error thrown by linkProgram in the Lines effect when gl.createProgram() returns null. Like createShader, the WebGL2 spec permits null under resource exhaustion or context loss; the Lines effect fails fast rather than proceeding with a null program.
Source
Thrown at packages/effects/src/lines.ts:328
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(`Lines 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(`Lines program link failed: ${log ?? '(no log)'}`);
}
return program;
};
const createProgram = (
gl: WebGL2RenderingContext,
vertexSource: string,
fragmentSource: string,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Lower concurrency in the render (fewer parallel browser pages / Chromium instances).
- Restart the render if a one-off context-loss event corrupted GPU state.
- Verify the host has adequate GPU memory / a stable software GL backend for headless runs.
Defensive patterns
Strategy: try-catch
Validate before calling
function canAllocateProgram(): boolean {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl) return false;
return !!gl.createProgram();
} Try / catch
try {
lines(...);
} catch (err) {
if (err instanceof Error && /WebGL program/.test(err.message)) {
// reduce concurrency, restart the page/context, then retry
} else throw err;
} Prevention
- Limit concurrent browser contexts so programs remain allocatable.
- Dispose of unused Remotion effects/contexts to free GL programs.
- Use a render host with adequate GPU memory.
When it happens
Trigger: The WebGL2 context is alive but cannot allocate a program object — typically GPU memory exhaustion, too many live programs, or a recently lost context. Occurs after the vertex and fragment shaders have already compiled successfully.
Common situations: Running many concurrent Remotion browser contexts that each compile WebGL programs; long-running render sessions that leak programs; headless environments with constrained software GL.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL texture
- Failed to create WebGL vertex array
- Failed to create WebGL buffer
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/049d2ef054fab923.
Report an issue: GitHub.