remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown by `setupBlur` when `gl.createVertexArray()` returns `null`. The VAO holds the shared fullscreen-quad bindings used by both blur passes. A null result is a resource/context-loss condition, not a usage error.

Source

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

export const setupBlur = (target: HTMLCanvasElement): BlurState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('blur effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const programHorizontal = createProgram(gl, BLUR_VS, BLUR_FS_HORIZONTAL);
	const programVertical = createProgram(gl, BLUR_VS, BLUR_FS_VERTICAL);

	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);

	gl.enableVertexAttribArray(0);
	gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guard with `gl.isContextLost()`; reinitialize after `webglcontextrestored`.
  2. Free unused blur states via `cleanupBlur`.
  3. Limit concurrent WebGL effects.
  4. Ensure hardware-accelerated WebGL2.

Example fix

if (gl.isContextLost()) {
  // reinitialize after restore
} else {
  const state = setupBlur(canvas);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (gl.isContextLost()) { /* skip setupBlur */ }

Try / catch

try {
  const state = setupBlur(canvas);
} catch (err) {
  if (/Failed to create WebGL vertex array/.test(err.message)) {
    // await restore or reduce effects, then retry
  } else { throw err; }
}

Prevention

When it happens

Trigger: Fires at line 126-128, after both blur programs are created, when `gl.createVertexArray()` yields null.

Common situations: Context loss during blur setup; VAO cap reached by many concurrent effects; software renderer with low object limits.

Related errors


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