remotion-dev/remotion · error · Error
Failed to create WebGL vertex array
Error message
Failed to create WebGL vertex array
What it means
Zigzag setup allocates a vertex array object (gl.createVertexArray) to bind its fullscreen-quad attributes; a null return means the GL context could not allocate the VAO, so the effect throws because every draw call depends on that VAO. This is a context/resource allocation failure, not an input problem.
Source
Thrown at packages/effects/src/zigzag.ts:432
};
const setupZigzag = (target: HTMLCanvasElement): ZigzagState => {
const gl = target.getContext('webgl2', {
premultipliedAlpha: true,
alpha: true,
preserveDrawingBuffer: true,
});
if (!gl) {
throw createWebGL2ContextError('zigzag effect');
}
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
const program = createProgram(gl, ZIGZAG_VS, ZIGZAG_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
- Verify WebGL2 context health (non-null getContext('webgl2'), isContextLost() false) before rendering.
- Render headless with Remotion's bundled Chromium and its configured software GPU; avoid GPU-disabling flags.
- Lower the count of simultaneously-active WebGL effects.
- Re-mount the composition on webglcontextlost so setup re-runs against a fresh context.
- Update GPU drivers or switch render host.
Defensive patterns
Strategy: try-catch
Validate before calling
const gl = document.createElement('canvas').getContext('webgl2');
const webglOk = gl != null && gl.createVertexArray() != null && !gl.isContextLost(); Type guard
const canAllocateVAO = (): boolean => {
const gl = document.createElement('canvas').getContext('webgl2');
return gl != null && !gl.isContextLost() && gl.createVertexArray() != null;
}; Try / catch
try {
return <VideoEffects effects={[zigzag({colors: ['#ff0000', '#00ff00']})]} />;
} catch (err) {
if (err instanceof Error && err.message === 'Failed to create WebGL vertex array') {
return <Video />;
}
throw err;
} Prevention
- Probe VAO allocation before mounting zigzag().
- Render with Remotion's bundled Chromium; avoid disabling the GPU.
- Cap concurrent WebGL effects to free VAO slots.
- Re-mount on webglcontextlost.
When it happens
Trigger: setupZigzag calls gl.createVertexArray() and receives null on the first zigzag frame.
Common situations: Headless renderer with incomplete WebGL2 VAO support; context lost; VAO-object limit hit across many concurrent effects; software GPU that caps VAO allocation.
Related errors
- Failed to create white balance texture
- Failed to create white balance vertex array
- Failed to create white balance vertex buffer
- Failed to create WebGL resources
- Failed to create WebGL texture
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/f9e1bb5de56cf343.
Report an issue: GitHub.