remotion-dev/remotion · critical · Error

Failed to create WebGL program

Error message

Failed to create WebGL program

What it means

Thrown by burlap's `linkProgram` when `gl.createProgram()` returns `null`. A resource-allocation failure: the GL implementation could not create another program object. Distinct from a link-status failure (handled at line 269).

Source

Thrown at packages/effects/src/burlap.ts:260

	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(`Burlap 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(`Burlap program link failed: ${log ?? '(no log)'}`);
	}

	return program;
};

const setupBurlap = (target: HTMLCanvasElement): BurlapState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guard with `gl.isContextLost()`; reinitialize on restoration.
  2. Free unused burlap states via burlap `cleanup`.
  3. Reduce concurrent WebGL effects.
  4. Ensure hardware-accelerated WebGL2; update drivers.

Example fix

if (gl.isContextLost()) {
  // reinitialize after webglcontextrestored
} else {
  burlap.setup(canvas);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (gl.isContextLost()) { /* skip setupBurlap */ }

Try / catch

try {
  burlap.setup(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 258-260 inside `linkProgram`, called from `setupBurlap`, when `gl.createProgram()` returns null.

Common situations: Context loss during burlap setup; program-object cap reached 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/0a855f6cbefe7213. Report an issue: GitHub.