remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown by `setupBurlap` when `gl.createVertexArray()` returns `null`. The VAO holds the burlap fullscreen-quad bindings (aPos/aUv). A null result is a resource/context-loss condition, not a usage mistake.

Source

Thrown at packages/effects/src/burlap.ts:295

		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('burlap effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const vs = compileShader(gl, gl.VERTEX_SHADER, BURLAP_VS);
	const fs = compileShader(gl, gl.FRAGMENT_SHADER, BURLAP_FS);
	const program = linkProgram(gl, vs, fs);
	gl.deleteShader(vs);
	gl.deleteShader(fs);

	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. Guard with `gl.isContextLost()`; reinitialize after `webglcontextrestored`.
  2. Free unused burlap states via burlap `cleanup`.
  3. Limit concurrent WebGL effects.
  4. Ensure hardware-accelerated WebGL2.

Example fix

if (gl.isContextLost()) {
  // reinitialize after restore
} else {
  burlap.setup(canvas);
}
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

try {
  burlap.setup(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 293-295, after the program is created and shaders deleted, when `gl.createVertexArray()` yields null.

Common situations: Context loss during burlap 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/89978fe6094b53ce. Report an issue: GitHub.