{"record":{"id":"6899a44e7fa3b427","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-6899a4","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/halftone.ts","lineNumber":430,"sourceCode":"\t\t\tpremultipliedAlpha: true,\n\t\t\talpha: true,\n\t\t\tpreserveDrawingBuffer: true,\n\t\t});\n\t\tif (!gl) {\n\t\t\tthrow createWebGL2ContextError('halftone effect');\n\t\t}\n\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\t\tconst vs = compileShader(gl, gl.VERTEX_SHADER, HALFTONE_VS);\n\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, HALFTONE_FS);\n\t\tconst program = linkProgram(gl, vs, fs);\n\t\tgl.deleteShader(vs);\n\t\tgl.deleteShader(fs);\n\n\t\tconst vao = gl.createVertexArray();\n\t\tif (!vao) {\n\t\t\tthrow new Error('Failed to create WebGL vertex array');\n\t\t}\n\n\t\tgl.bindVertexArray(vao);\n\n\t\tconst data = new Float32Array([\n\t\t\t-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,\n\t\t]);\n\n\t\tconst vbo = gl.createBuffer();\n\t\tif (!vbo) {\n\t\t\tthrow new Error('Failed to create WebGL buffer');\n\t\t}\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\t\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\t\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\t\tconst aUv = gl.getAttribLocation(program, 'aUv');","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/halftone.ts#L412-L448","documentation":"Thrown in setup() of the halftone effect when gl.createVertexArray() returns null. Identical mechanism to the linear-gradient VAO error: the GL implementation refused to allocate another VAO, normally under object-budget exhaustion or context loss. The effect cannot bind vertex attributes without a VAO, so it treats null as fatal.","triggerScenarios":"Halftone setup() running when the GL context's VAO budget is exhausted or the context is lost; many simultaneous WebGL2 effects on a low-resource GPU.","commonSituations":"Heavy compositions stacking WebGL2 effects; long render/Studio sessions leaking GL objects; GPU process crash.","solutions":["Confirm gl.isContextLost() and restart if true.","Reduce WebGL2 effect count or reuse effect state across frames.","Render on hardware with more GPU headroom.","Restart Chrome/Studio to clear leaked objects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Probe whether the context will allocate a VAO before relying on the effect.\nfunction canCreateVao(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const vao = gl.createVertexArray();\n  const ok = vao !== null;\n  if (vao) gl.deleteVertexArray(vao);\n  return ok;\n}","typeGuard":null,"tryCatchPattern":"try {\n  // ...use halftone()\n} catch (e) {\n  if (e instanceof Error && /Failed to create WebGL vertex array/.test(e.message)) {\n    // context loss or VAO budget exhausted; restart render\n  } else throw e;\n}","preventionTips":["Keep concurrent WebGL2 effect count within the GPU's VAO budget.","Reuse effect state across frames rather than re-allocating VAOs each frame.","Restart the worker after a context-lost event."],"tags":["webgl","halftone","gpu-resources","context-loss","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}