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

  1. Guard with `gl.isContextLost()` and reinitialize on restoration.
  2. Free unused blur states via `cleanupBlur` (deletes both programs).
  3. Reduce the number of concurrently active WebGL effects.
  4. 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

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


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/322ddf18fe12cbb4. Report an issue: GitHub.