remotion-dev/remotion · error · Error

Failed to create exposure vertex buffer

Error message

Failed to create exposure vertex buffer

What it means

Thrown during setupExposure() when gl.createBuffer() returns null (exposure.ts:186-188). A null VBO means the driver declined to allocate another buffer object — context lost or the buffer-object pool exhausted. The fullscreen-quad vertex data has no storage, so exposure setup aborts.

Source

Thrown at packages/effects/src/exposure.ts:187

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

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl);
	const vao = gl.createVertexArray();
	if (!vao) {
		throw new Error('Failed to create exposure vertex array');
	}

	const vbo = gl.createBuffer();
	if (!vbo) {
		throw new Error('Failed to create exposure vertex buffer');
	}

	gl.bindVertexArray(vao);
	gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
	gl.bufferData(
		gl.ARRAY_BUFFER,
		new Float32Array([-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1]),
		gl.STATIC_DRAW,
	);

	const aPos = gl.getAttribLocation(program, 'aPos');
	const aUv = gl.getAttribLocation(program, 'aUv');
	gl.enableVertexAttribArray(aPos);
	gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);
	gl.enableVertexAttribArray(aUv);
	gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);
	gl.bindVertexArray(null);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Render with --gl=angle (CLI) / chromiumOptions.gl='angle' (SSR) / Angle (Studio).
  2. Guarantee effect cleanup() runs (it calls gl.deleteBuffer); do not retain stale exposure states.
  3. Lower simultaneous WebGL2 effect count and reuse identical exposure() params.
  4. Check gl.isContextLost() and restore before retrying.
  5. Use a render host with adequate GPU memory or a stable software GL path.

Example fix

// before
const vbo = gl.createBuffer();
if (!vbo) {
  throw new Error('Failed to create exposure vertex buffer');
}

// after (caller guard)
if (gl.isContextLost()) {
  throw new Error('exposure setup aborted: WebGL2 context lost');
}
Defensive patterns

Strategy: try-catch

Validate before calling

const canAllocateBuffer = (gl: WebGL2RenderingContext): boolean => {
  if (gl.isContextLost()) return false;
  const probe = gl.createBuffer();
  if (!probe) return false;
  gl.deleteBuffer(probe);
  return true;
};

Try / catch

try {
  // apply exposure(); for a custom canvas: const state = setupExposure(canvas);
} catch (err) {
  if (err instanceof Error && err.message === 'Failed to create exposure vertex buffer') {
    // free other effects, restore context, retry on Angle
    throw err;
  }
  throw err;
}

Prevention

When it happens

Trigger: setupExposure() gets past createVertexArray() but gl.createBuffer() returns null. This happens on a lost context or when leaked VBOs from un-cleaned effects have exhausted the driver's buffer-object budget.

Common situations: Studio sessions accumulating un-cleaned effect canvases; compositions rendering many WebGL2 effects at once; headless CI with constrained GL resources; contexts reported lost after a GPU crash.

Related errors


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