remotion-dev/remotion · error · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

Thrown in setupCornerPin when gl.createVertexArray() returns null. The WebGL2 context was acquired but could not allocate a VAO. This is a GPU resource exhaustion or context-loss issue internal to corner-pin setup.

Source

Thrown at packages/effects/src/corner-pin/corner-pin-runtime.ts:109

};

export const setupCornerPin = (target: HTMLCanvasElement): CornerPinState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('corner pin effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, CORNER_PIN_VS, CORNER_PIN_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);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Reduce concurrent WebGL effects to lower VAO allocation.
  2. Verify context health with gl.isContextLost().
  3. Use a GPU-capable rendering environment.
  4. Handle webglcontextlost for recovery.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify WebGL2 context health before corner pin setup
const gl = target.getContext('webgl2');
if (gl?.isContextLost()) {
  // defer or skip
}

Try / catch

try {
  cornerPin({...})(source, target);
} catch (e) {
  if (e instanceof Error && e.message === 'Failed to create WebGL vertex array') {
    // GPU resource issue — reduce concurrent effects
  }
  throw e;
}

Prevention

When it happens

Trigger: During corner-pin effect initialization, after the shader program is created, gl.createVertexArray() returns null.

Common situations: Too many VAOs across concurrent effects; context lost; GPU memory pressure; constrained software WebGL in headless/CI/VM environments.

Related errors


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