{"record":{"id":"f9e1bb5de56cf343","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-f9e1bb","errorCode":null,"errorMessage":"Failed to create WebGL vertex array","messagePattern":"Failed to create WebGL vertex array","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/zigzag.ts","lineNumber":432,"sourceCode":"};\n\nconst setupZigzag = (target: HTMLCanvasElement): ZigzagState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {\n\t\tthrow createWebGL2ContextError('zigzag effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, ZIGZAG_VS, ZIGZAG_FS);\n\n\tconst vao = gl.createVertexArray();\n\tif (!vao) {\n\t\tthrow new Error('Failed to create WebGL vertex array');\n\t}\n\n\tgl.bindVertexArray(vao);\n\n\tconst data = new Float32Array([\n\t\t-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,\n\t]);\n\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) {\n\t\tthrow new Error('Failed to create WebGL buffer');\n\t}\n\n\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\tconst aUv = gl.getAttribLocation(program, 'aUv');","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/zigzag.ts#L414-L450","documentation":"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.","triggerScenarios":"setupZigzag calls gl.createVertexArray() and receives null on the first zigzag frame.","commonSituations":"Headless renderer with incomplete WebGL2 VAO support; context lost; VAO-object limit hit across many concurrent effects; software GPU that caps VAO allocation.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const gl = document.createElement('canvas').getContext('webgl2');\nconst webglOk = gl != null && gl.createVertexArray() != null && !gl.isContextLost();","typeGuard":"const canAllocateVAO = (): boolean => {\n  const gl = document.createElement('canvas').getContext('webgl2');\n  return gl != null && !gl.isContextLost() && gl.createVertexArray() != null;\n};","tryCatchPattern":"try {\n  return <VideoEffects effects={[zigzag({colors: ['#ff0000', '#00ff00']})]} />;\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL vertex array') {\n    return <Video />;\n  }\n  throw err;\n}","preventionTips":["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."],"tags":["webgl","gpu","rendering","headless","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}