{"record":{"id":"8d1bea437c5ed296","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-8d1bea","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/liquid-contours.ts","lineNumber":334,"sourceCode":"\t\t);\n\t}\n\n\treturn program;\n};\n\nconst setup = (target: HTMLCanvasElement): LiquidContoursState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) throw createWebGL2ContextError('liquid contours effect');\n\tconst program = createProgram(gl);\n\tconst vao = gl.createVertexArray();\n\tif (!vao) throw new Error('Failed to create WebGL vertex array');\n\tgl.bindVertexArray(vao);\n\tconst vbo = gl.createBuffer();\n\tif (!vbo) throw new Error('Failed to create WebGL buffer');\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\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\tgl.bindVertexArray(null);\n\tconst colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;\n\tcolorCanvas.height = 1;\n\tconst colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});\n\tif (!colorCtx)","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/liquid-contours.ts#L316-L352","documentation":"A plain Error thrown inside setup in the Liquid contours effect when gl.createBuffer() returns null. The buffer holds the static full-screen quad data; allocation failure means geometry cannot be uploaded and the effect aborts.","triggerScenarios":"WebGL2 context is alive but cannot allocate a buffer object — GPU memory exhaustion or context loss. Reached immediately after the VAO is created and bound, before bufferData with the quad Float32Array.","commonSituations":"Heavy concurrent rendering saturating GPU memory; leaked GL objects; headless software GL with a small buffer budget; a transient context-loss event.","solutions":["Lower render concurrency.","Ensure previous effects/contexts are disposed so buffers are reclaimed.","Render on a host with adequate GPU memory / a stable GL backend."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function canAllocateBuffer(): boolean {\n  const c = document.createElement('canvas');\n  const gl = c.getContext('webgl2');\n  if (!gl) return false;\n  return !!gl.createBuffer();\n}","typeGuard":null,"tryCatchPattern":"try {\n  liquidContours(...);\n} catch (err) {\n  if (err instanceof Error && /WebGL buffer/.test(err.message)) {\n    // free buffers / reduce concurrency, then retry\n  } else throw err;\n}","preventionTips":["Dispose of finished effects/contexts so GL buffers are reclaimed.","Lower render concurrency to stay within GPU buffer limits.","Use a render host with adequate GPU memory."],"tags":["webgl2","liquid-contours-effect","gpu","buffer","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}