remotion-dev/remotion · critical · Error

Failed to create WebGL shader

Error message

Failed to create WebGL shader

What it means

Thrown by compileShader in the glow effect when gl.createShader() returns null. Same GPU-level failure class as the flannel shader allocation: context lost, invalid type, or resource exhaustion. Shader source problems surface as 612 instead.

Source

Thrown at packages/effects/src/glow/glow-runtime.ts:57

	};
	readonly composite: {
		readonly uSource: WebGLUniformLocation | null;
		readonly uGlow: WebGLUniformLocation | null;
		readonly uIntensity: WebGLUniformLocation | null;
	};
	readonly colorCtx: CanvasRenderingContext2D;
	cachedColorStr: string;
	cachedColorRgba: ParsedColorRgba;
};

const compileShader = (
	gl: WebGL2RenderingContext,
	type: number,
	source: string,
): WebGLShader => {
	const shader = gl.createShader(type);
	if (!shader) {
		throw new Error('Failed to create WebGL shader');
	}

	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(`Glow shader compile failed: ${log ?? '(no log)'}`);
	}

	return shader;
};

const linkProgram = (
	gl: WebGL2RenderingContext,
	vs: WebGLShader,
	fs: WebGLShader,
): WebGLProgram => {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce the number of concurrent WebGL effects.
  2. Retry on a fresh Chrome instance.
  3. Use a host with healthier GPU resources.
Defensive patterns

Strategy: retry

Try / catch

let effect;
for (let attempt = 0; attempt < 3; attempt++) {
  try {
    effect = glow(params);
    break;
  } catch (err) {
    if (attempt === 2 || !/WebGL|shader/i.test(String(err))) throw err;
    await new Promise((r) => setTimeout(r, 200 * (attempt + 1)));
  }
}

Prevention

When it happens

Trigger: Calling glow() on a lost WebGL2 context; concurrent WebGL effects exhausting shader object pools; driver bug refusing allocation.

Common situations: Many glow layers in one composition; Lambda/headless render under memory pressure; resumed after GPU reset.

Related errors


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