remotion-dev/remotion · critical · Error

Failed to create WebGL vertex array

Error message

Failed to create WebGL vertex array

What it means

During thermal vision effect `setup`, `gl.createVertexArray()` returned `null`. A VAO could not be allocated, indicating context loss or GL resource exhaustion. The error fires after the program is created and shaders are deleted, before geometry upload.

Source

Thrown at packages/effects/src/thermal-vision.ts:241

};

const setupThermalVision = (target: HTMLCanvasElement): ThermalVisionState => {
	const gl = target.getContext('webgl2', {
		premultipliedAlpha: true,
		alpha: true,
		preserveDrawingBuffer: true,
	});
	if (!gl) {
		throw createWebGL2ContextError('thermal vision effect');
	}

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, THERMAL_VISION_VS, THERMAL_VISION_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. Reduce concurrent webgl2 effects.
  2. Restart the render/session to reset GL state.
  3. Verify headless browser WebGL2 support.
  4. Handle `webglcontextlost` to recreate contexts.
Defensive patterns

Strategy: fallback

Try / catch

try {
  thermalVision({...params});
} catch (e) {
  if (/Failed to create WebGL vertex array/.test((e as Error).message)) {
    renderFallbackFrame();
  } else throw e;
}

Prevention

When it happens

Trigger: Context lost between program creation and VAO allocation; driver out of VAO resources; destroyed/degraded GL context.

Common situations: High concurrent webgl2 effect count; long sessions after a driver reset; restrictive headless WebGL2 backends.

Related errors


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