remotion-dev/remotion · error · Error
Failed to create WebGL program
Error message
Failed to create WebGL program
What it means
Internal error from the `roughenEdges()` effect setup: `gl.createProgram()` returned `null` after both shaders compiled. The driver refused to allocate a program object. Environment-level allocation failure (context loss, GPU resource exhaustion), not a param error.
Source
Thrown at packages/effects/src/roughen-edges.ts:324
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
const log = gl.getShaderInfoLog(shader);
gl.deleteShader(shader);
throw new Error(
`Roughen edges 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(`Roughen edges program link failed: ${log ?? '(no log)'}`);
}
return program;
};
const createSourceTexture = (gl: WebGL2RenderingContext): WebGLTexture => {
const texture = gl.createTexture();
if (!texture) {
throw new Error('Failed to create WebGL texture');View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Refresh the page or restart the render.
- Cut down the number of simultaneously mounted effects.
- Update drivers or move to a hardware-accelerated environment.
- Add a `webglcontextlost`/`webglcontextrestored` handler to rebuild programs.
Defensive patterns
Strategy: try-catch
Validate before calling
const supportsWebGL2Programs = (): boolean => {
try {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl) return false;
return !!gl.createProgram();
} catch {
return false;
}
}; Try / catch
try {
roughenEdges()({...});
} catch (err) {
if (err instanceof Error && /Failed to create WebGL program/.test(err.message)) {
// treat as transient GPU resource failure; offer a reload
} else {
throw err;
}
} Prevention
- Feature-detect WebGL2 program allocation before mounting effects.
- Reduce concurrent effect count to free program objects.
- Handle `webglcontextlost` to rebuild programs on restore.
- Use hardware acceleration in CI.
When it happens
Trigger: Mounting `roughenEdges()` on a lost context; exhausting the driver's program-object pool with many concurrent effects; software GL backend under heavy memory load.
Common situations: Heavy Studio compositions; CI runners with constrained GPU memory; systems recovering from a GPU crash.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL texture
- Failed to create WebGL noise texture
- Failed to create WebGL vertex array
- Failed to create WebGL shader
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/159daddd32be8103.
Report an issue: GitHub.