{"record":{"id":"0f7f1e117fac5f6b","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-0f7f1e","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/fisheye/fisheye-runtime.ts","lineNumber":121,"sourceCode":"\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, FISHEYE_VS, FISHEYE_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/fisheye/fisheye-runtime.ts#L103-L139","documentation":"Thrown during setupFisheye() when gl.createBuffer() returns null (fisheye-runtime.ts:119-122). A null VBO means the driver declined to allocate another buffer object — context lost or the buffer-object pool exhausted. The fisheye fullscreen-quad vertex data has no storage, so setup aborts.","triggerScenarios":"setupFisheye() gets past createVertexArray() but gl.createBuffer() returns null. This happens on a lost context or when leaked VBOs (from setupFisheye() without cleanupFisheye(), or many effect() instances) have exhausted the driver's buffer-object budget.","commonSituations":"Apps using fisheye-runtime directly without cleanupFisheye(); long-running sessions accumulating un-cleaned effect canvases; compositions rendering many WebGL2 effects at once; headless CI with constrained GL resources; contexts reported lost after a GPU crash.","solutions":["Render with --gl=angle (CLI) / chromiumOptions.gl='angle' (SSR) / Angle (Studio).","If using fisheye-runtime directly, always pair setupFisheye() with cleanupFisheye() (it calls gl.deleteBuffer).","Lower simultaneous WebGL2 effect count and reuse identical fisheye() params via calculateKey.","Check gl.isContextLost() and restore 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 (cleanup discipline for direct runtime use)\nconst state = setupFisheye(canvas);\ntry { /* applyFisheye(...) */ } finally { cleanupFisheye(state); }","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":"import {setupFisheye, cleanupFisheye} from '@remotion/effects/fisheye-runtime';\n\nlet state;\ntry {\n  state = setupFisheye(canvas);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL buffer') {\n    // free other fisheye states, restore context, retry on Angle\n    throw err;\n  }\n  throw err;\n}\ntry { /* applyFisheye(state, ...) */ } finally { cleanupFisheye(state); }","preventionTips":["When using fisheye-runtime directly, always pair setupFisheye() with cleanupFisheye() (gl.deleteBuffer).","Render with Angle (--gl=angle / chromiumOptions.gl='angle').","Limit simultaneous WebGL2 effects; reuse identical fisheye() params via calculateKey.","Handle webglcontextlost and restore before retrying."],"tags":["webgl","buffer","vbo","resource-allocation","gpu","fisheye","setup"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}