{"record":{"id":"9ccf253078d88dc5","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-9ccf25","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/pixel-dissolve.ts","lineNumber":254,"sourceCode":"\treturn program;\n};\n\nconst createFullscreenQuad = (\n\tgl: WebGL2RenderingContext,\n): {\n\treadonly vao: WebGLVertexArrayObject;\n\treadonly vbo: WebGLBuffer;\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 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(\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\n\treturn {vao, vbo};\n};\n\nexport const pixelDissolve = createEffect<\n\tPixelDissolveParams,\n\tPixelDissolveState\n>({\n\ttype: 'dev.remotion.effects.pixelDissolve',\n\tlabel: 'pixelDissolve()',","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pixel-dissolve.ts#L236-L272","documentation":"Thrown by pixelDissolve's createFullscreenQuad when gl.createBuffer() returns null after the VAO was already allocated and bound. WebGL2 returns null on buffer allocation when the context is lost or GPU memory for vertex buffers is exhausted. The null-check aborts before bindBuffer/bufferData would silently no-op.","triggerScenarios":"pixelDissolve setup reaches createBuffer() (VAO succeeded) but the GL implementation refuses to allocate a new ARRAY_BUFFER. This is the second allocation in createFullscreenQuad, so it implies the context was healthy enough to make a VAO but degraded by the time a buffer was requested.","commonSituations":"GPU memory pressure from many simultaneously loaded video textures; context loss arriving between the VAO and buffer calls; SwiftShader under memory pressure in Lambda; a buggy driver that caps buffer count below the VAO count.","solutions":["Free other GPU resources before mounting pixelDissolve — unload unused video/image sources and other WebGL effects first.","Check that the context is not lost: `const ext = gl.getExtension('WEBGL_lose_context'); gl.isContextLost()` and remount if true.","On Lambda, use a larger memory function (3008 MB+) so Chrome has more headroom for GPU buffers.","Reduce concurrent pixelDissolve instances to one per composition pass.","If reproducible only on a specific machine, update or roll back the GPU driver."],"exampleFix":"// before\nimport {pixelDissolve} from '@remotion/effects';\nconst effect = pixelDissolve();\n\n// after — verify the live context can allocate before relying on the effect\nfunction glCanAllocateBuffer(gl: WebGL2RenderingContext): boolean {\n  if (gl.isContextLost()) return false;\n  const probe = gl.createBuffer();\n  const ok = probe !== null;\n  if (probe) gl.deleteBuffer(probe);\n  return ok;\n}","handlingStrategy":"try-catch","validationCode":"function glCanCreateBuffer(gl: WebGL2RenderingContext): boolean {\n  if (gl.isContextLost()) return false;\n  const b = gl.createBuffer();\n  if (b) gl.deleteBuffer(b);\n  return b !== null;\n}","typeGuard":null,"tryCatchPattern":"try {\n  pixelDissolve();\n} catch (err) {\n  if (/Failed to create WebGL buffer/.test((err as Error).message)) {\n    // free other GPU resources and retry, or fall back to a non-WebGL effect\n  }\n  throw err;\n}","preventionTips":["Free unused video/image sources before mounting many effects.","Keep concurrent WebGL2 effect count low in one composition.","Monitor gl.isContextLost() before each render pass.","Use a Lambda function with enough memory for buffer headroom."],"tags":["webgl","gpu","memory","pixel-dissolve","rendering","headless"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}