{"record":{"id":"87df2b9e7d515473","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-vertex-array-87df2b","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/liquid-contours.ts","lineNumber":331,"sourceCode":"\t\tgl.deleteProgram(program);\n\t\tthrow new Error(\n\t\t\t`Liquid contours program link failed: ${log ?? '(no log)'}`,\n\t\t);\n\t}\n\n\treturn program;\n};\n\nconst setup = (target: HTMLCanvasElement): LiquidContoursState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) throw createWebGL2ContextError('liquid contours effect');\n\tconst program = createProgram(gl);\n\tconst vao = gl.createVertexArray();\n\tif (!vao) throw new Error('Failed to create WebGL vertex array');\n\tgl.bindVertexArray(vao);\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) throw new Error('Failed to create WebGL buffer');\n\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\tgl.bufferData(\n\t\tgl.ARRAY_BUFFER,\n\t\tnew Float32Array([-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1]),\n\t\tgl.STATIC_DRAW,\n\t);\n\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\tconst aUv = gl.getAttribLocation(program, 'aUv');\n\tgl.enableVertexAttribArray(aPos);\n\tgl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n\tgl.enableVertexAttribArray(aUv);\n\tgl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n\tgl.bindVertexArray(null);\n\tconst colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/liquid-contours.ts#L313-L349","documentation":"A plain Error thrown inside setup in the Liquid contours effect when gl.createVertexArray() returns null. The VAO holds the quad's attribute bindings; without it the effect cannot draw, so setup aborts right after createProgram and before buffer allocation.","triggerScenarios":"WebGL2 context is alive but cannot allocate a VAO — resource exhaustion or context loss. Not param-dependent; runs on every Liquid contours effect setup after the program is linked.","commonSituations":"Concurrent render saturation of GPU objects; a leaked context; flaky VAO support in software GL; a context-loss race.","solutions":["Reduce concurrent renders / browser contexts.","Handle webglcontextlost and re-run the effect on webglcontextrestored.","Use a render host with a robust WebGL2 implementation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function canAllocateVao(): boolean {\n  const c = document.createElement('canvas');\n  const gl = c.getContext('webgl2');\n  if (!gl) return false;\n  return !!gl.createVertexArray();\n}","typeGuard":null,"tryCatchPattern":"try {\n  liquidContours(...);\n} catch (err) {\n  if (err instanceof Error && /WebGL vertex array/.test(err.message)) {\n    // restart context / lower concurrency, then retry\n  } else throw err;\n}","preventionTips":["Limit concurrent GL contexts so VAOs stay allocatable.","Handle webglcontextlost / webglcontextrestored and rebuild the effect.","Render on a host with a robust WebGL2 implementation."],"tags":["webgl2","liquid-contours-effect","gpu","vao","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}