remotion-dev/remotion · critical · Error
Failed to create WebGL vertex array
Error message
Failed to create WebGL vertex array
What it means
Thrown by setupNoise (packages/effects/src/noise.ts:204) when gl.createVertexArray() returns null while building the VAO that binds the noise effect's quad attributes. A null VAO means the WebGL2 context is lost or the per-context VAO budget is exhausted.
Source
Thrown at packages/effects/src/noise.ts:204
premultipliedAlpha: true,
alpha: true,
preserveDrawingBuffer: true,
});
if (!gl) {
throw createWebGL2ContextError('noise effect');
}
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
const vs = compileShader(gl, gl.VERTEX_SHADER, NOISE_VS);
const fs = compileShader(gl, gl.FRAGMENT_SHADER, NOISE_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');View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Run effect cleanup (gl.deleteVertexArray) between usages and limit concurrent WebGL2 effects.
- Render on a GPU-capable host with WebGL enabled in headless Chrome.
- Check gl.isContextLost() before setup and retry after restoration.
Example fix
// before
const vao = gl.createVertexArray(); // null -> throws
// after
if (gl.isContextLost()) {
throw new Error('WebGL2 context lost; cannot create noise VAO');
} Defensive patterns
Strategy: try-catch
Validate before calling
function canCreateNoiseVao(): boolean {
try {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl || gl.isContextLost()) return false;
const v = gl.createVertexArray();
const ok = !!v;
if (v) gl.deleteVertexArray(v);
return ok;
} catch {
return false;
}
} Try / catch
try {
scene.push(noise({amount: 0.2}));
} catch (err) {
if (/Failed to create WebGL vertex array/.test(String(err?.message))) {
// VAO budget exhausted or context lost: omit the effect
} else throw err;
} Prevention
- Delete VAOs via cleanup between usages.
- Limit concurrent WebGL2 effects.
- Handle webglcontextlost and re-run setup after restore.
When it happens
Trigger: setupNoise creating the VAO on a lost context or after too many live VAOs; running many noise/WebGL2 effects concurrently without disposing their VAOs.
Common situations: Context loss mid-render; long Studio sessions leaking VAOs; GPU memory pressure on integrated graphics; headless render without a real GPU.
Related errors
- Failed to create WebGL shader
- Failed to create WebGL program
- Failed to create WebGL buffer
- Failed to create WebGL texture
- Failed to create WebGL noise texture
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/191a4f297eabd0cc.
Report an issue: GitHub.