remotion-dev/remotion · error · Error

Failed to create WebGL buffer

Error message

Failed to create WebGL buffer

What it means

Thrown by setupDuotone() when gl.createBuffer() returns null while building the fullscreen-quad VBO. The VAO was created moments before, so a null buffer points to context loss or buffer-object exhaustion rather than bad input.

Source

Thrown at packages/effects/src/duotone.ts:229

	gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

	const program = createProgram(gl, DUOTONE_VS, DUOTONE_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');
	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);

	const textureSource = createRgbaTexture(gl);

	const colorCanvas = document.createElement('canvas');
	colorCanvas.width = 1;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Render with a software backend: `npx remotion render <comp> --gl=swiftshader`.
  2. Lower render concurrency.
  3. Restart the render worker / relaunch Chrome to recover a lost context.
  4. Update GPU drivers / Chromium.
Defensive patterns

Strategy: try-catch

Try / catch

async function safeRender(opts) {
  try {
    return await renderMedia(opts);
  } catch (err) {
    if (/Failed to create WebGL buffer/.test(String(err?.message ?? ''))) {
      return await renderMedia({...opts, gl: 'swiftshader', concurrency: 1});
    }
    throw err;
  }
}

Prevention

When it happens

Trigger: First-frame duotone() setup where the driver cannot allocate the 16-byte Float32Array vertex buffer, typically because the context was lost or GPU buffer memory is exhausted.

Common situations: Many concurrent GPU renders, a crashed GPU process, or a constrained headless environment.

Related errors


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