remotion-dev/remotion · error · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
Thrown by linkProgram in corner-pin-runtime.ts when gl.createProgram() returns null. The WebGL2 context was acquired and both shaders compiled, but the GPU could not allocate a program object. This is a resource-exhaustion or context-loss issue.
Source
Thrown at packages/effects/src/corner-pin/corner-pin-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 concurrent WebGL effects to lower program allocation.
- Verify context health with gl.isContextLost().
- Use a GPU-capable rendering environment.
- Handle webglcontextlost for recovery.
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify context health before applying corner pin
const gl = target.getContext('webgl2');
if (gl?.isContextLost()) {
// defer or skip
} Try / catch
try {
cornerPin({...})(source, target);
} catch (e) {
if (e instanceof Error && e.message === 'Failed to create WebGL program') {
// GPU resource exhaustion or context loss
}
throw e;
} Prevention
- Reduce concurrent WebGL effects to lower program allocation.
- Check gl.isContextLost() before relying on WebGL effects.
- Use a GPU-capable rendering environment.
- Handle webglcontextlost to reinitialize after recovery.
When it happens
Trigger: During setupCornerPin, after both shaders compile, gl.createProgram() returns null.
Common situations: Too many WebGL programs across concurrent effects; GPU memory pressure; context lost between shader compilation and program creation; constrained software WebGL in headless/CI environments.
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/22812507071b239c.
Report an issue: GitHub.