{"record":{"id":"b56e483ffd9797ba","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-b56e48","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/chromatic-aberration/chromatic-aberration-runtime.ts","lineNumber":125,"sourceCode":"\t\tgl,\n\t\tCHROMATIC_ABERRATION_VS,\n\t\tCHROMATIC_ABERRATION_FS,\n\t);\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":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts#L107-L143","documentation":"Thrown by setupChromaticAberration when gl.createBuffer() returns null after a WebGL2 context was already acquired. A null buffer means the GL implementation could not allocate another buffer object, which happens under GPU memory/object pressure or after the context is lost. The chromatic aberration effect cannot build its fullscreen-quad vertex buffer without it, so effect setup aborts.","triggerScenarios":"Render of a composition using chromaticAberration() on a machine/driver where the WebGL2 context exists but gl.createBuffer() yields null. Reached inside setupChromaticAberration at chromatic-aberration-runtime.ts:124, after the program, VAO, and vertex data are already prepared. Occurs when too many GL buffer objects are live, GPU memory is exhausted, or gl.isContextLost() flipped true mid-setup.","commonSituations":"High-concurrency headless Chrome renders (many parallel browser contexts each allocating GL objects), CI without GPU acceleration (SwiftShader software GL with tight object limits), a long render that hits a context-loss event, or running in a constrained VM/container. Not caused by chromaticAberration() parameters.","solutions":["Lower render concurrency so fewer WebGL contexts/buffers are alive at once (e.g. --concurrency=1 or lower in the render CLI / Lambda config).","Run headless Chrome with GPU enabled (--enable-gpu / use a GPU-equipped Lambda layer or machine) instead of pure software rendering.","Check for WebGL context loss: in your render environment, ensure drivers and the Chrome build are current; restart the render if it was a transient loss.","Reduce the number of distinct WebGL-backed effects stacked on the same frame, or split the render across more frames with fewer concurrent contexts.","If reproducing locally, open chrome://gpu and confirm WebGL2 is hardware-accelerated, not software-only."],"exampleFix":"// before: many parallel renders exhaust GL buffer objects\nremotion render main --concurrency=8\n\n// after: one GL context at a time avoids buffer allocation failure\nremotion render main --concurrency=1","handlingStrategy":"retry","validationCode":"// Feature-detect WebGL2 buffer allocation capacity in the render environment\n// (run once, not per frame) before relying on WebGL effects.\nfunction webgl2BufferAvailable(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl) return false;\n    const buf = gl.createBuffer();\n    const ok = buf !== null;\n    if (buf) gl.deleteBuffer(buf);\n    const lose = gl.getExtension('WEBGL_lose_context');\n    lose?.loseContext();\n    return ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"// Wrap the render call; on a GL resource error, retry once at lower concurrency\n// or fall back to a composition without the WebGL effect.\ntry {\n  await renderMedia({...});\n} catch (err) {\n  if (/Failed to create WebGL buffer/i.test(String(err))) {\n    await renderMedia({...opts, concurrency: 1}); // retry single-threaded\n  } else {\n    throw err;\n  }\n}","preventionTips":["Cap render concurrency in CI and Lambda to keep live WebGL contexts low.","Render on GPU-enabled environments (GPU Lambda layer / --enable-gpu headless Chrome) rather than software GL.","Keep drivers and Chromium current to avoid object-allocation regressions.","Avoid stacking many WebGL-backed effects on the same frame."],"tags":["webgl","gpu-resource-exhaustion","chromatic-aberration","rendering","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}