{"record":{"id":"d8d47cc15c4cfb46","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-d8d47c","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/waves.ts","lineNumber":450,"sourceCode":"};\n\nconst setupWaves = (target: HTMLCanvasElement): WavesState => {\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('waves effect');\n\t}\n\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, WAVES_VS, WAVES_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":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/waves.ts#L432-L468","documentation":"Thrown by setupWaves() when gl.createVertexArray() returns null. A VAO is needed to encapsulate the vertex attribute bindings (aPos, aUv) for the fullscreen quad. createVertexArray returns null on context loss, context destruction, or resource exhaustion.","triggerScenarios":"Called from setupWaves() at packages/effects/src/waves.ts:448 after the program is created. Fires when the GL context cannot allocate a VAO. Since the program and shaders were already created, this indicates progressive resource exhaustion or a context-loss event between program creation and VAO creation.","commonSituations":"Context loss mid-setup; many concurrent effect canvases exhausting VAO slots; GPU instability in long render sessions; constrained environments (mobile GPU, VM).","solutions":["Handle 'webglcontextlost'/'webglcontextrestored' events and re-run setupWaves on a fresh canvas.","Reduce concurrent effect instances and ensure cleanup runs.","Update GPU drivers or switch render backends.","Recycle worker processes in server-side rendering."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"const gl = canvas.getContext('webgl2');\nif (!gl || gl.isContextLost()) {\n  return;\n}\ntry {\n  const state = setupWaves(canvas);\n} catch (e) {\n  if ((e as Error).message === 'Failed to create WebGL vertex array') {\n    console.warn('Waves VAO allocation failed:', (e as Error).message);\n  }\n}","preventionTips":["Handle context loss/restoration events on effect canvases.","Clean up old waves effect states before creating new ones.","Limit concurrent WebGL effects per composition."],"tags":["webgl","gpu","vao","resource-exhaustion","waves-effect"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}