remotion-dev/remotion · error · Error
Failed to create WebGL buffer
Error message
Failed to create WebGL buffer
What it means
Thrown by setupProgressivePixelate when gl.createBuffer() returns null after the VAO was created and bound. The null-check aborts before bindBuffer/bufferData would silently no-op.
Source
Thrown at packages/effects/src/progressive-pixelate-runtime.ts:197
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
const vs = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);
const fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);
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);
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 texture = gl.createTexture();
if (!texture) {
throw new Error('Failed to create WebGL texture');
}
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Check `gl.isContextLost()` and remount on restore.
- Reduce concurrent WebGL2 effects and free unused assets.
- Increase Lambda function memory.
- Render at a lower resolution.
- Reproduce locally to isolate environment.
Example fix
// before
setupProgressivePixelate(canvas);
// after — probe buffer allocation
function glCanCreateBuffer(gl: WebGL2RenderingContext): boolean {
if (gl.isContextLost()) return false;
const b = gl.createBuffer();
if (b) gl.deleteBuffer(b);
return b !== null;
} Defensive patterns
Strategy: try-catch
Validate before calling
function glCanCreateBuffer(gl: WebGL2RenderingContext): boolean {
if (gl.isContextLost()) return false;
const b = gl.createBuffer();
if (b) gl.deleteBuffer(b);
return b !== null;
} Try / catch
try {
setupProgressivePixelate(canvas);
} catch (err) {
if (/Failed to create WebGL buffer/.test((err as Error).message)) {
// reduce GPU load, free assets, retry
}
throw err;
} Prevention
- Free unused source assets before applying effects.
- Keep concurrent WebGL2 effects low.
- Render at lower resolution to reduce buffer traffic.
- Monitor gl.isContextLost() each pass.
When it happens
Trigger: setupProgressivePixelate: VAO succeeded, then gl.createBuffer() returns null.
Common situations: GPU memory pressure; context loss mid-setup; SwiftShader under load; many effects holding buffers.
Related errors
- Failed to create WebGL buffer
- Failed to create WebGL texture
- 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/12d7b3dfc9f47f55.
Report an issue: GitHub.