remotion-dev/remotion · critical · Error
Failed to create WebGL buffer
Error message
Failed to create WebGL buffer
What it means
Thrown by `setupBarrelDistortion` when `gl.createBuffer()` returns `null`. The buffer is the VBO that backs the fullscreen quad (16 floats: position + UV). A null handle indicates the GL context could not allocate another buffer object — a resource/context-loss condition.
Source
Thrown at packages/effects/src/barrel-distortion/barrel-distortion-runtime.ts:121
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
const program = createProgram(gl, BARREL_DISTORTION_VS, BARREL_DISTORTION_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
- Guard setup with `gl.isContextLost()` and reinitialize on `webglcontextrestored`.
- Free unused effect states via `cleanupBarrelDistortion` to release VBOs.
- Reduce concurrently active effects / canvases.
- Ensure hardware-accelerated WebGL2 in the render environment.
Example fix
if (gl.isContextLost()) {
// skip setup, reinitialize after webglcontextrestored
} else {
const state = setupBarrelDistortion(canvas);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (gl.isContextLost()) { /* skip setup */ } Try / catch
try {
const state = setupBarrelDistortion(canvas);
} catch (err) {
if (/Failed to create WebGL buffer/.test(err.message)) {
// await restore, reduce effects, retry
} else { throw err; }
} Prevention
- Release VBOs via cleanup on unused states.
- Handle context-loss events.
- Limit concurrent effects.
When it happens
Trigger: Fires at line 119-121, after the VAO is created and bound, when `gl.createBuffer()` returns null.
Common situations: Context loss during setup; buffer object limit reached from many live WebGL effects; software renderer with a low buffer cap.
Related errors
- Failed to create WebGL buffer
- Failed to create WebGL vertex array
- Failed to create WebGL texture
- Failed to create WebGL shader
- Failed to create WebGL program
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/117a31b3f67f95a5.
Report an issue: GitHub.