{"record":{"id":"371610c872ce9a64","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-371610","errorCode":null,"errorMessage":"Failed to create WebGL vertex array","messagePattern":"Failed to create WebGL vertex array","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/mirror/mirror-runtime.ts","lineNumber":109,"sourceCode":"};\n\nexport const setupMirror = (target: HTMLCanvasElement): MirrorState => {\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('mirror effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, MIRROR_VS, MIRROR_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\tgl.enableVertexAttribArray(0);\n\tgl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/mirror/mirror-runtime.ts#L91-L127","documentation":"While setting up the mirror effect's geometry, gl.createVertexArray() returned null. The WebGL2 context exists (program and shaders are already created) but cannot allocate a VAO. This indicates context degradation, resource limits, or driver issues.","triggerScenarios":"During setupMirror, after createProgram succeeds, gl.createVertexArray() returns null. The vertex array object is needed to encapsulate the vertex attribute bindings for the fullscreen quad.","commonSituations":"Context loss during setup; GPU driver hitting VAO allocation limits; headless environments with incomplete WebGL2 VAO support; very old GPU hardware.","solutions":["Ensure the environment fully supports WebGL2 VAOs — update GPU drivers.","Handle WebGL context loss and retry the render.","For headless/CI rendering, verify Chrome's GPU configuration.","Reduce concurrent WebGL effect usage."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // apply mirror effect\n} catch (e) {\n  if (e instanceof Error && e.message.includes('WebGL vertex array')) {\n    console.warn('WebGL VAO creation failed, skipping mirror effect');\n    // fallback path\n  } else {\n    throw e;\n  }\n}","preventionTips":["Ensure WebGL2 VAO support in the render environment — update GPU drivers.","Handle context loss and retry rendering.","Limit concurrent WebGL effects to avoid VAO allocation limits."],"tags":["webgl","gpu","environment","mirror-effect","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}