remotion-dev/remotion · error · Error
Failed to create WebGL buffer
Error message
Failed to create WebGL buffer
What it means
pattern() allocates a VBO for the fullscreen-quad vertices. gl.createBuffer() returns null when the context is lost or the driver refuses further allocations. This guard converts the silent null into an explicit setup failure before bindBuffer/bufferData.
Source
Thrown at packages/effects/src/pattern.ts:478
const fs = compileShader(gl, gl.FRAGMENT_SHADER, PATTERN_FS);
const program = linkProgram(gl, vs, fs);
gl.deleteShader(vs);
gl.deleteShader(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 texture = gl.createTexture();
if (!texture) {
throw new Error('Failed to create WebGL texture');
}View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Guarantee a live WebGL2 context via webglcontextlost/webglcontextrestored handling.
- Reduce simultaneous GPU effects to stay under driver object limits.
- Use a supported GPU or SwiftShader in headless rendering.
- Update GPU drivers.
Defensive patterns
Strategy: try-catch
Try / catch
try {
initPattern(canvas); // allocates the quad VBO
} catch (err) {
if (isContextLost(canvas)) waitForRestore(canvas).then(initPattern);
else throw err;
} Prevention
- Guarantee a live WebGL2 context by handling webglcontextlost/restored.
- Limit concurrent GPU effects to avoid exhausting driver buffer limits.
- Use a supported GPU or SwiftShader in headless rendering.
- Update GPU drivers.
When it happens
Trigger: Reached in pattern()'s initializer right after the VAO is created and bound. gl.createBuffer() returns null due to context loss or driver resource exhaustion.
Common situations: Context lost mid-setup; too many GL buffers alive across stacked effects; headless render under memory pressure; outdated GPU drivers.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL program
- Failed to create WebGL vertex array
- Failed to create WebGL texture
- Failed to create WebGL texture
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/48a7ce94d494d6d2.
Report an issue: GitHub.