{"record":{"id":"353cb4c74983fb41","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-353cb4","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/linear-gradient.ts","lineNumber":238,"sourceCode":"\t\tthrow createWebGL2ContextError('linear gradient effect');\n\t}\n\n\tconst program = createProgram(gl);\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\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\n\tgl.bindVertexArray(null);\n\n\tconst colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;\n\tcolorCanvas.height = 1;\n\tconst colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/linear-gradient.ts#L220-L256","documentation":"Thrown by setupLinearGradient() when gl.createBuffer() returns null while building the vertex buffer for the fullscreen quad. The library cannot upload the quad's vertex/UV data without a buffer, so it aborts setup.","triggerScenarios":"Same family as the other GL null-allocations: the WebGL2 context exists but refuses a new buffer object. Typical of a context in a failing state, GPU memory exhaustion, or too many live GL objects across concurrent renders.","commonSituations":"Concurrent Lambda/local renders saturating driver object limits; a crashed Chrome GPU process leaving the context half-dead; integrated GPUs under memory pressure; very long Studio sessions leaking buffers.","solutions":["Recover by restarting Chrome / the render worker and retrying once.","Reduce concurrency to cut the number of simultaneous GL allocations.","Force a software GL backend (`--gl=angle --angle-backend=swiftshader`).","If reproducing in Studio, reload the page / restart dev server to release leaked objects.","Update Chrome and GPU drivers on the host for persistent failures."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"function canAllocateBuffer(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const b = gl.createBuffer();\n  const ok = b !== null;\n  if (b) gl.deleteBuffer(b);\n  return ok;\n}","typeGuard":null,"tryCatchPattern":"try {\n  renderWithLinearGradient();\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL buffer') {\n    await restartRendererWorker();\n    renderWithLinearGradient();\n  } else throw err;\n}","preventionTips":["Cap concurrency to reduce simultaneous GL object allocations.","Ensure effect cleanup frees buffers on unmount.","Recycle workers after GPU-process crashes.","Reload Studio / restart the dev server when long sessions leak buffers."],"tags":["webgl","gpu","rendering","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}