{"record":{"id":"9a90ed3bd68fd13f","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-9a90ed","errorCode":null,"errorMessage":"Failed to create WebGL buffer","messagePattern":"Failed to create WebGL buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/evolve.ts","lineNumber":281,"sourceCode":"\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, EVOLVE_FS);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(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');\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\n\tgl.bindVertexArray(null);\n\n\tconst textureSource = createRgbaTexture(gl);\n\n\treturn {\n\t\tgl,","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/evolve.ts#L263-L299","documentation":"Thrown during setupEvolve() when gl.createBuffer() returns null (evolve.ts:280-282). A null VBO means the GL driver declined to allocate another buffer object — context lost or buffer/VBO pool exhausted. The fullscreen-quad vertex data has nowhere to live, so evolve setup fails.","triggerScenarios":"evolve() setup runs on a lost WebGL2 context, or the driver has run out of buffer objects due to leaked VBOs from effects whose cleanup() never ran. The guard is the `if (!vbo)` check after the VAO is bound.","commonSituations":"Long-running Studio sessions accumulating un-cleaned effect canvases; compositions rendering dozens of WebGL2 effects at once; headless CI with constrained GPU resources; post-GPU-crash contexts that report lost.","solutions":["Render with --gl=angle (CLI) / chromiumOptions.gl='angle' (SSR) / Angle (Studio) for reliable buffer allocation.","Make sure effect lifecycles call cleanup() (it invokes gl.deleteBuffer); don't retain stale evolve states.","Lower the simultaneous WebGL2 effect count in the composition and reuse identical evolve() params (calculateKey caching).","Check gl.isContextLost() and restore the context before retrying.","Use a render host with adequate GPU memory or a stable software GL path."],"exampleFix":"// before\nconst vbo = gl.createBuffer();\nif (!vbo) {\n  throw new Error('Failed to create WebGL buffer');\n}\n\n// after (defensive caller check)\nif (gl.isContextLost()) {\n  throw new Error('evolve setup aborted: WebGL2 context lost');\n}","handlingStrategy":"try-catch","validationCode":"const canAllocateBuffer = (gl: WebGL2RenderingContext): boolean => {\n  if (gl.isContextLost()) return false;\n  const probe = gl.createBuffer();\n  if (!probe) return false;\n  gl.deleteBuffer(probe);\n  return true;\n};","typeGuard":null,"tryCatchPattern":"try {\n  // apply evolve(); for a custom canvas: const state = setupEvolve(canvas);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL buffer') {\n    // free other effects, restore context, retry on Angle\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Render with Angle (--gl=angle / chromiumOptions.gl='angle').","Ensure effect cleanup() runs so VBOs are deleted, not leaked.","Limit simultaneous WebGL2 effects; reuse identical evolve() params.","Handle webglcontextlost and restore before retrying."],"tags":["webgl","buffer","vbo","resource-allocation","gpu","evolve","setup"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}