{"record":{"id":"bfbb9b17244251a6","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-bfbb9b","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/dot-grid.ts","lineNumber":223,"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('dot grid 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, DOT_GRID_VS);\n\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, DOT_GRID_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":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/dot-grid.ts#L205-L241","documentation":"Thrown by dot-grid's setup() when gl.createVertexArray() returns null. A null VAO means the WebGL2 context is lost, destroyed, or resource-exhausted. Reached after the program is linked and shaders are deleted, when the geometry VAO is being constructed.","triggerScenarios":"Lost WebGL2 context, exhausted VAO object limit, or GPU memory pressure. Triggered inside dotGrid().setup() during the geometry allocation phase.","commonSituations":"Many effects leaking VAOs (cleanup paths skipped); GPU reset; headless rendering with constrained software GL; long Studio sessions without reload.","solutions":["Confirm effect cleanup runs (so VAOs are deleted via gl.deleteVertexArray in cleanup).","Reduce simultaneous WebGL2 effects per composition.","Reload the page; if the context was lost it may recover on next mount.","For headless rendering, use SwiftShader and adequate memory.","Update GPU drivers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = () => {\n  try {\n    return !!document.createElement('canvas').getContext('webgl2');\n  } catch {\n    return false;\n  }\n};\n\nif (!supportsWebGL2()) {\n  // skip the dotGrid() effect","typeGuard":null,"tryCatchPattern":"try {\n  state = dotGrid().setup(canvas);\n} catch (err) {\n  if (err instanceof Error && /vertex array/i.test(err.message)) {\n    console.error('VAO allocation failed:', err.message);\n    // fall back or recover\n  } else {\n    throw err;\n  }\n}","preventionTips":["Confirm cleanup runs (gl.deleteVertexArray) on unmount.","Limit simultaneous WebGL2 effects; reload to reclaim leaked VAOs.","Use SwiftShader with adequate memory in headless runs; update drivers."],"tags":["webgl2","dot-grid","vertex-array","vao","gpu","runtime"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}