remotion-dev/remotion · error · Error
Failed to create WebGL buffer
Error message
Failed to create WebGL buffer
What it means
Thrown by setupChromaticAberration when gl.createBuffer() returns null after a WebGL2 context was already acquired. A null buffer means the GL implementation could not allocate another buffer object, which happens under GPU memory/object pressure or after the context is lost. The chromatic aberration effect cannot build its fullscreen-quad vertex buffer without it, so effect setup aborts.
Source
Thrown at packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts:125
gl,
CHROMATIC_ABERRATION_VS,
CHROMATIC_ABERRATION_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);
const textureSource = createRgbaTexture(gl);
return {
gl,
program,
vao,View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Lower render concurrency so fewer WebGL contexts/buffers are alive at once (e.g. --concurrency=1 or lower in the render CLI / Lambda config).
- Run headless Chrome with GPU enabled (--enable-gpu / use a GPU-equipped Lambda layer or machine) instead of pure software rendering.
- Check for WebGL context loss: in your render environment, ensure drivers and the Chrome build are current; restart the render if it was a transient loss.
- Reduce the number of distinct WebGL-backed effects stacked on the same frame, or split the render across more frames with fewer concurrent contexts.
- If reproducing locally, open chrome://gpu and confirm WebGL2 is hardware-accelerated, not software-only.
Example fix
// before: many parallel renders exhaust GL buffer objects remotion render main --concurrency=8 // after: one GL context at a time avoids buffer allocation failure remotion render main --concurrency=1
Defensive patterns
Strategy: retry
Validate before calling
// Feature-detect WebGL2 buffer allocation capacity in the render environment
// (run once, not per frame) before relying on WebGL effects.
function webgl2BufferAvailable(): boolean {
try {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl) return false;
const buf = gl.createBuffer();
const ok = buf !== null;
if (buf) gl.deleteBuffer(buf);
const lose = gl.getExtension('WEBGL_lose_context');
lose?.loseContext();
return ok;
} catch {
return false;
}
} Try / catch
// Wrap the render call; on a GL resource error, retry once at lower concurrency
// or fall back to a composition without the WebGL effect.
try {
await renderMedia({...});
} catch (err) {
if (/Failed to create WebGL buffer/i.test(String(err))) {
await renderMedia({...opts, concurrency: 1}); // retry single-threaded
} else {
throw err;
}
} Prevention
- Cap render concurrency in CI and Lambda to keep live WebGL contexts low.
- Render on GPU-enabled environments (GPU Lambda layer / --enable-gpu headless Chrome) rather than software GL.
- Keep drivers and Chromium current to avoid object-allocation regressions.
- Avoid stacking many WebGL-backed effects on the same frame.
When it happens
Trigger: Render of a composition using chromaticAberration() on a machine/driver where the WebGL2 context exists but gl.createBuffer() yields null. Reached inside setupChromaticAberration at chromatic-aberration-runtime.ts:124, after the program, VAO, and vertex data are already prepared. Occurs when too many GL buffer objects are live, GPU memory is exhausted, or gl.isContextLost() flipped true mid-setup.
Common situations: High-concurrency headless Chrome renders (many parallel browser contexts each allocating GL objects), CI without GPU acceleration (SwiftShader software GL with tight object limits), a long render that hits a context-loss event, or running in a constrained VM/container. Not caused by chromaticAberration() parameters.
Related errors
- Failed to create color correction shader
- Failed to create color correction shader program
- Failed to create color correction texture
- Failed to create color correction vertex array
- Failed to create color correction vertex buffer
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/b56e483ffd9797ba.
Report an issue: GitHub.