{"record":{"id":"117a31b3f67f95a5","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-117a31","errorCode":null,"errorMessage":"Failed to create WebGL buffer","messagePattern":"Failed to create WebGL buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/barrel-distortion/barrel-distortion-runtime.ts","lineNumber":121,"sourceCode":"\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, BARREL_DISTORTION_VS, BARREL_DISTORTION_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);\n\tgl.enableVertexAttribArray(1);\n\tgl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);\n\n\tgl.bindVertexArray(null);\n\n\tconst textureSource = createRgbaTexture(gl);\n\n\treturn {\n\t\tgl,\n\t\tprogram,\n\t\tvao,","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/barrel-distortion/barrel-distortion-runtime.ts#L103-L139","documentation":"Thrown by `setupBarrelDistortion` when `gl.createBuffer()` returns `null`. The buffer is the VBO that backs the fullscreen quad (16 floats: position + UV). A null handle indicates the GL context could not allocate another buffer object — a resource/context-loss condition.","triggerScenarios":"Fires at line 119-121, after the VAO is created and bound, when `gl.createBuffer()` returns null.","commonSituations":"Context loss during setup; buffer object limit reached from many live WebGL effects; software renderer with a low buffer cap.","solutions":["Guard setup with `gl.isContextLost()` and reinitialize on `webglcontextrestored`.","Free unused effect states via `cleanupBarrelDistortion` to release VBOs.","Reduce concurrently active effects / canvases.","Ensure hardware-accelerated WebGL2 in the render environment."],"exampleFix":"if (gl.isContextLost()) {\n  // skip setup, reinitialize after webglcontextrestored\n} else {\n  const state = setupBarrelDistortion(canvas);\n}","handlingStrategy":"try-catch","validationCode":"if (gl.isContextLost()) { /* skip setup */ }","typeGuard":null,"tryCatchPattern":"try {\n  const state = setupBarrelDistortion(canvas);\n} catch (err) {\n  if (/Failed to create WebGL buffer/.test(err.message)) {\n    // await restore, reduce effects, retry\n  } else { throw err; }\n}","preventionTips":["Release VBOs via cleanup on unused states.","Handle context-loss events.","Limit concurrent effects."],"tags":["webgl2","buffer","vbo","gpu-memory","barrel-distortion","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}