{"record":{"id":"99a6eb91ce8f0367","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-99a6eb","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/burlap.ts","lineNumber":306,"sourceCode":"\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, BURLAP_FS);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(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\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 texture = gl.createTexture();\n\tif (!texture) {\n\t\tthrow new Error('Failed to create WebGL texture');\n\t}","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/burlap.ts#L288-L324","documentation":"Thrown by setupBurlap when gl.createBuffer() returns null while allocating the fullscreen-quad vertex buffer for the burlap effect. A WebGL2 buffer allocation returns null only when the GL context is lost, the GPU process has crashed, or the implementation has run out of addressable GL objects. The effect cannot render its shader without this buffer, so initialization aborts.","triggerScenarios":"Calling the Burlap effect during setupBurlap() on a canvas whose WebGL2 context is lost, in a process where the GPU process crashed, or after the browser has exhausted the per-context GL object budget. The line gl.createBuffer() at burlap.ts:304 returns null and the guard at :305 throws.","commonSituations":"Rendering many Remotion compositions concurrently (each takes its own WebGL2 context), headless Chrome with --disable-gpu or SwiftShader under memory pressure, GPU blacklisted by the browser, running Remotion Lambda/headless in a VM without GPU acceleration, or a context-loss event fired during tab throttling on integrated GPUs.","solutions":["Reduce the number of simultaneously live WebGL-using effects/compositions; reuse a single canvas where possible.","Ensure GPU acceleration is enabled in the renderer (remove --disable-gpu, use a headed/GPU Chromium such as Remotion's Chrome for Testing).","Listen for the canvas 'webglcontextlost' event and tear down / recreate the effect on 'webglcontextrestored'.","Update GPU drivers and verify WebGL2 support at https://get.webgl.org/webgl2/.","On Remotion Lambda/serverless, increase the function memory tier or switch to a GPU-enabled instance family."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Probe WebGL2 availability + a non-lost context before mounting heavy effects.\nfunction probeWebGL2(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    return !!gl && !gl.isContextLost();\n  } catch {\n    return false;\n  }\n}\nif (!probeWebGL2()) skipOrFallback();","typeGuard":null,"tryCatchPattern":"// Wrap effect usage so a setup failure surfaces as a render-time error boundary,\n// not an uncaught throw during composition mounting.\ntry {\n  return <Burlap {...props} />;\n} catch (err) {\n  if (/Failed to create WebGL buffer/.test(String(err))) {\n    return <FallbackFrame />;\n  }\n  throw err;\n}","preventionTips":["Limit the number of simultaneously mounted WebGL effects/compositions; each takes its own context.","Always call the effect cleanup path on unmount to free GL objects.","Listen for 'webglcontextlost' on the canvas and rebuild on 'webglcontextrestored'.","Run Remotion headless rendering with a GPU-accelerated Chromium (e.g. Chrome for Testing), never --disable-gpu under load."],"tags":["webgl","gpu","effects","burlap","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}