{"record":{"id":"b41aa5fb3e6dd4b5","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-b41aa5","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/wave/wave-runtime.ts","lineNumber":133,"sourceCode":"\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\n\tconst program = createProgram(gl, WAVE_VS, WAVE_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":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/wave/wave-runtime.ts#L115-L151","documentation":"Thrown by setupWave() when gl.createBuffer() returns null. A WebGL buffer object creation returns null on context loss, context destruction, or GPU resource exhaustion. The buffer is needed to hold the fullscreen-quad vertex data (position + UV) for the wave effect's draw call.","triggerScenarios":"Called from setupWave() at packages/effects/src/wave/wave-runtime.ts:131 after the VAO is created and bound. Fires when the GL context cannot allocate a buffer object — almost always context loss or resource exhaustion, since program and VAO creation already succeeded moments before.","commonSituations":"GPU resource exhaustion from many simultaneous WebGL contexts in a long render; context loss during setup; running on a GPU with very limited buffer object slots; the browser's GPU process crashed mid-setup.","solutions":["Handle 'webglcontextlost' / 'webglcontextrestored' events to recreate the effect state.","Reduce the number of concurrent effect canvases and ensure cleanupWave() is called on discarded effects.","Update GPU drivers and test on a different GPU/renderer (e.g., SwiftShader vs hardware) to isolate driver bugs.","For headless/server rendering, recycle the worker process between heavy jobs to free GPU resources."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const state = setupWave(canvas);\n} catch (e) {\n  if ((e as Error).message === 'Failed to create WebGL buffer') {\n    console.warn('Buffer allocation failed — possible context loss:', (e as Error).message);\n  }\n}","preventionTips":["Ensure cleanupWave is called on discarded effects to free buffer objects.","Handle context loss/restoration events.","Recycle render worker processes in long-running sessions."],"tags":["webgl","gpu","buffer","resource-exhaustion","wave-effect"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}