remotion-dev/remotion · error · Error
Failed to create WebGL vertex array
Error message
Failed to create WebGL vertex array
What it means
Internal error from the `roughenEdges()` effect setup: `gl.createVertexArray()` returned `null`. The VAO encapsulates the quad's position/uv attribute bindings. Environment-level allocation failure (context loss, VAO-object exhaustion, non-conformant driver), not a param error.
Source
Thrown at packages/effects/src/roughen-edges.ts:439
const setupRoughenEdges = (target: HTMLCanvasElement): RoughenEdgesState => {
const gl = target.getContext('webgl2', {
premultipliedAlpha: true,
alpha: true,
preserveDrawingBuffer: true,
});
if (!gl) {
throw createWebGL2ContextError('roughen edges effect');
}
const vs = compileShader(gl, gl.VERTEX_SHADER, ROUGHEN_EDGES_VS);
const fs = compileShader(gl, gl.FRAGMENT_SHADER, ROUGHEN_EDGES_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
- Refresh the page or restart the render for a fresh context.
- Reduce the number of concurrently mounted effects.
- Handle `webglcontextlost`/`webglcontextrestored` to rebuild VAOs.
- Update GPU drivers or switch to a hardware-accelerated environment.
Defensive patterns
Strategy: try-catch
Validate before calling
const canAllocateVao = (): boolean => {
try {
const c = document.createElement('canvas');
const gl = c.getContext('webgl2');
if (!gl) return false;
const vao = gl.createVertexArray();
if (vao) gl.deleteVertexArray(vao);
return !!vao;
} catch {
return false;
}
}; Try / catch
try {
roughenEdges()({...});
} catch (err) {
if (err instanceof Error && /Failed to create WebGL vertex array/.test(err.message)) {
// surface a 'GPU resource limit reached' message and reduce effects
} else {
throw err;
}
} Prevention
- Feature-detect VAO allocation on the target context.
- Limit the number of concurrently mounted effects.
- Handle context loss/restore to rebuild VAOs.
- Use hardware acceleration where possible.
When it happens
Trigger: Mounting `roughenEdges()` on a context that was just lost; exhausting the driver's VAO pool with many concurrent effects; a non-conformant WebGL2 implementation where VAO creation is unreliable.
Common situations: Long Studio sessions; complex multi-effect compositions; rendering on virtual GPUs.
Related errors
- Failed to create WebGL vertex array
- Failed to create WebGL shader
- Failed to create WebGL program
- 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/dee118989a34f344.
Report an issue: GitHub.