remotion-dev/remotion · error · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown by setupProgressivePixelate when gl.createVertexArray() returns null after program link. Same VAO allocation-failure pattern as pixelate, specific to progressive-pixelate setup.

Source

Thrown at packages/effects/src/progressive-pixelate-runtime.ts:188

	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('progressive pixelate effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
	const vs = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);
	const fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);
	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);
	gl.enableVertexAttribArray(0);
	gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);
	gl.enableVertexAttribArray(1);
	gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);
	gl.bindVertexArray(null);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Check `gl.isContextLost()` and remount on restore.
  2. Reduce concurrent WebGL2 effects.
  3. Increase Lambda function memory.
  4. Reproduce on stable desktop Chrome.
  5. Free other GPU resources before applying the effect.

Example fix

// before
setupProgressivePixelate(canvas);

// after — probe VAO allocation
function glCanCreateVao(gl: WebGL2RenderingContext): boolean {
  if (gl.isContextLost()) return false;
  const v = gl.createVertexArray();
  if (v) gl.deleteVertexArray(v);
  return v !== null;
}
Defensive patterns

Strategy: try-catch

Validate before calling

function glCanCreateVao(gl: WebGL2RenderingContext): boolean {
  if (gl.isContextLost()) return false;
  const v = gl.createVertexArray();
  if (v) gl.deleteVertexArray(v);
  return v !== null;
}

Try / catch

try {
  setupProgressivePixelate(canvas);
} catch (err) {
  if (/Failed to create WebGL vertex array/.test((err as Error).message)) {
    // remount after context restore
  }
  throw err;
}

Prevention

When it happens

Trigger: setupProgressivePixelate: program linked, then gl.createVertexArray() returns null.

Common situations: Context lost between program link and VAO creation; VAO pool exhausted; SwiftShader under load; integrated GPU with low VAO cap.

Related errors


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