remotion-dev/remotion · critical · Error
Failed to create WebGL buffer
Error message
Failed to create WebGL buffer
What it means
A plain Error thrown inside setupLines when gl.createBuffer() returns null. This buffer holds the Lines full-screen quad vertex data (positions + uvs); allocation failure means the effect cannot upload geometry and aborts.
Source
Thrown at packages/effects/src/lines.ts:401
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
const program = createProgram(gl, LINES_VS, LINES_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 colorCanvas = document.createElement('canvas');
colorCanvas.width = 1;
colorCanvas.height = 1;
const colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Lower render concurrency.
- Ensure previous effects/contexts are disposed so buffers are reclaimed.
- Render on a host with adequate GPU memory / a stable GL backend.
Defensive patterns
Strategy: try-catch
Validate before calling
function canAllocateBuffer(): boolean {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl) return false;
return !!gl.createBuffer();
} Try / catch
try {
lines(...);
} catch (err) {
if (err instanceof Error && /WebGL buffer/.test(err.message)) {
// free buffers / reduce concurrency, then retry
} else throw err;
} Prevention
- Dispose of prior effects/contexts so GL buffers are reclaimed.
- Lower render concurrency to keep GPU buffers available.
- Use a render host with adequate GPU memory.
When it happens
Trigger: WebGL2 context is alive but cannot allocate a buffer object — GPU memory exhaustion or context loss. Reached after the VAO is created and bound, immediately before bufferData with the static quad array.
Common situations: Heavy concurrent rendering saturating GPU memory; a leaked context; headless software GL with limited buffer capacity; a context-loss race.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL program
- Failed to create WebGL texture
- Failed to create WebGL vertex array
- Failed to create WebGL buffer
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/2b7c5ce28110dbd6.
Report an issue: GitHub.