remotion-dev/remotion · error · Error

Failed to create WebGL program

Error message

Failed to create WebGL program

What it means

Internal error from the `rings()` effect's WebGL2 setup: `gl.createProgram()` returned `null` after both shaders compiled successfully. The driver refused to allocate a program object. Like the other `Failed to create WebGL *` errors this is an environment-level allocation failure (context loss, GPU resource exhaustion), not a param validation error.

Source

Thrown at packages/effects/src/rings.ts:299

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

	return program;
};

const createProgram = (
	gl: WebGL2RenderingContext,
	vertexSource: string,
	fragmentSource: string,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Refresh the page or restart the render to obtain a fresh context.
  2. Lower the count of simultaneously active effects.
  3. Update GPU drivers or move to a hardware-accelerated environment.
  4. Add a `webglcontextlost` listener so the effect is torn down and re-created on restore.
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;
  } finally {
    /* canvas is GC'd */
  }
};

Try / catch

try {
  rings()({...});
} 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

When it happens

Trigger: Mounting `rings()` on a canvas whose context was just lost; running many effects concurrently until the implementation-defined program limit is reached; rendering on a software WebGL2 backend under heavy memory pressure.

Common situations: Studio sessions with many stacked effect layers; CI runners with constrained GPU memory; systems resuming from sleep where the GPU context is in a bad state.

Related errors


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