remotion-dev/remotion · critical · Error

Failed to create WebGL program

Error message

Failed to create WebGL program

What it means

After successfully compiling the vertex and fragment shaders, the region-blur runtime calls gl.createProgram(). If the WebGL2 context returns null, there is no program object to attach shaders to, and the effect throws. A null result signals context loss or resource exhaustion.

Source

Thrown at packages/effects/src/region-blur/region-blur-runtime.ts:111

	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 createProgram = (
	gl: WebGL2RenderingContext,
	vertexSource: string,
	fragmentSource: string,
): WebGLProgram => {
	const vertexShader = compileShader(gl, gl.VERTEX_SHADER, vertexSource);
	const fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);
	const program = gl.createProgram();
	if (!program) {
		throw new Error('Failed to create WebGL program');
	}

	gl.attachShader(program, vertexShader);
	gl.attachShader(program, fragmentShader);
	gl.linkProgram(program);
	gl.deleteShader(vertexShader);
	gl.deleteShader(fragmentShader);
	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 createTexture = (gl: WebGL2RenderingContext): WebGLTexture => {
	const texture = gl.createTexture();

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Register 'webglcontextlost'/'webglcontextrestored' handlers and reinitialize
  2. Dispose of unused effects to free program objects
  3. Reduce concurrent GPU effects in the composition
  4. Restart the render in a fresh browser process
Defensive patterns

Strategy: retry

Try / catch

canvas.addEventListener('webglcontextlost', (e) => { e.preventDefault(); }, false);
canvas.addEventListener('webglcontextrestored', () => {
  // re-initialize region-blur effect
}, false);

Prevention

When it happens

Trigger: Calling setupRegionBlur() on a lost or destroyed WebGL2 context, or when the program object pool has been depleted by other effects.

Common situations: Context loss after GPU crash; too many concurrent WebGL2 effects; mobile GPUs with tight program object limits; headless Chrome with accumulated GL state issues.

Related errors


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