remotion-dev/remotion · error · Error

Failed to create WebGL shader

Error message

Failed to create WebGL shader

What it means

Thrown by the venetian-blinds effect's compileShader helper when gl.createShader() returns null during setupVenetianBlinds. A null shader handle means the WebGL2 context is lost or the GPU has exhausted its object allocation budget. The library fails immediately rather than proceeding with a null shader.

Source

Thrown at packages/effects/src/venetian-blinds.ts:191

void main() {
	vec4 source = texture(uSource, vUv);
	float axis = uDirection == 0 ? vUv.x : vUv.y;
	float local = fract(axis * max(uSlats, 1.0));
	float distanceToCenter = abs(local - 0.5) * 2.0;
	float mask = maskValue(distanceToCenter, uProgress);

	fragColor = vec4(source.rgb * mask, source.a * mask);
}
`;

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

	return shader;
};

const linkProgram = (
	gl: WebGL2RenderingContext,
	vs: WebGLShader,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce render concurrency to lower the number of simultaneous WebGL2 contexts
  2. Ensure hardware GPU acceleration in the rendering browser (proper Chrome GPU flags)
  3. Listen for webglcontextlost and restart the render job after webglcontextrestored
  4. Update GPU drivers or move to an environment with a dedicated GPU
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const state = setupVenetianBlinds(canvas);
} catch (err) {
  if (err instanceof Error && err.message === 'Failed to create WebGL shader') {
    // GL context lost or GPU exhausted — restart the render process.
    throw new Error('WebGL2 context unavailable for venetian-blinds. Retry render.');
  }
  throw err;
}

Prevention

When it happens

Trigger: setupVenetianBlinds -> compileShader -> gl.createShader(gl.VERTEX_SHADER or gl.FRAGMENT_SHADER) returns null. Occurs under context loss (WEBGL_lose_context), GPU memory exhaustion, or when too many GL contexts are alive in the process.

Common situations: Headless rendering (Lambda/CI) with many parallel jobs; GPU driver crash or TDR mid-render; long-running Studio sessions that leak GL contexts; VMs with software rendering and low object limits.

Related errors


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