remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown when `gl.createVertexArray()` returns null during linearGradientTint setup. The VAO encapsulates the fullscreen-quad attrib layout. Null only occurs under context loss or VAO-handle exhaustion.

Source

Thrown at packages/effects/src/linear-gradient-tint.ts:285

const setupLinearGradientTint = (
	target: HTMLCanvasElement,
): LinearGradientTintState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('linear gradient tint effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl);

	const vao = gl.createVertexArray();
	if (!vao) {
		throw new Error('Failed to create WebGL vertex array');
	}

	gl.bindVertexArray(vao);

	const data = new Float32Array([
		-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,
	]);

	const vbo = gl.createBuffer();
	if (!vbo) {
		throw new Error('Failed to create WebGL buffer');
	}

	gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
	gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);

	const aPos = gl.getAttribLocation(program, 'aPos');
	const aUv = gl.getAttribLocation(program, 'aUv');

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pair setup with cleanup and reuse cached state.
  2. Recover on `webglcontextlost`/`webglcontextrestored`.
  3. Reduce simultaneously active WebGL effects.
  4. Restart workers showing GL handle growth.
Defensive patterns

Strategy: fallback

Try / catch

try {
  setupLinearGradientTint(canvas);
} catch (err) {
  renderWithoutEffect();
}

Prevention

When it happens

Trigger: Many concurrent WebGL effects exhausting VAO handles; setup on a lost context; constrained driver VAO limits reached.

Common situations: Dozens of stacked effects per frame; long-lived workers; headless Chromium leaking VAOs.

Related errors


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