{"record":{"id":"425e53f869e6ddc1","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-425e53","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/halftone-linear-gradient.ts","lineNumber":465,"sourceCode":"\t\t);\n\t\tconst program = linkProgram(gl, vs, fs);\n\t\tgl.deleteShader(vs);\n\t\tgl.deleteShader(fs);\n\n\t\tconst vao = gl.createVertexArray();\n\t\tif (!vao) {\n\t\t\tthrow new Error('Failed to create WebGL vertex array');\n\t\t}\n\n\t\tgl.bindVertexArray(vao);\n\n\t\tconst data = new Float32Array([\n\t\t\t-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,\n\t\t]);\n\n\t\tconst vbo = gl.createBuffer();\n\t\tif (!vbo) {\n\t\t\tthrow new Error('Failed to create WebGL buffer');\n\t\t}\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\t\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\t\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\t\tconst aUv = gl.getAttribLocation(program, 'aUv');\n\t\tgl.enableVertexAttribArray(aPos);\n\t\tgl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n\t\tgl.enableVertexAttribArray(aUv);\n\t\tgl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n\n\t\tgl.bindVertexArray(null);\n\n\t\tconst texture = gl.createTexture();\n\t\tif (!texture) {\n\t\t\tthrow new Error('Failed to create WebGL texture');\n\t\t}","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/halftone-linear-gradient.ts#L447-L483","documentation":"Thrown in setup() of the halftone-linear-gradient effect when gl.createBuffer() returns null. The library needs a vertex buffer to upload the fullscreen-quad attributes; a null buffer means WebGL2 refused to allocate another GL object, which happens under object-budget exhaustion or context loss.","triggerScenarios":"Same shape as the VAO failure: too many concurrent WebGL2 effect states, or a context that has been lost. Specifically this fires after the VAO succeeds but before attributes are uploaded, so the buffer pool is the first object type that hit the cap.","commonSituations":"Heavy compositions stacking many WebGL2 effects on integrated GPUs; rendering after the GPU process crashed but the Remotion worker kept the same context; long-running Studio sessions leaking GL objects.","solutions":["Confirm gl.isContextLost(); if true, restart the render or Studio — the context cannot recover in place.","Lower the count of WebGL2 effects in the affected composition or share effect state across frames.","Move rendering to a machine with more GPU headroom or a newer driver.","Restart Chrome/Studio to clear leaked GL objects from a prior session."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Probe whether the GL context can still allocate a buffer before committing to the effect.\nfunction canCreateBuffer(canvas: HTMLCanvasElement): boolean {\n  const gl = canvas.getContext('webgl2');\n  if (!gl) return false;\n  const buf = gl.createBuffer();\n  const ok = buf !== null;\n  if (buf) gl.deleteBuffer(buf);\n  return ok;\n}","typeGuard":null,"tryCatchPattern":"try {\n  // ...use halftoneLinearGradient()\n} catch (e) {\n  if (e instanceof Error && /Failed to create WebGL buffer/.test(e.message)) {\n    // treat as context loss / resource exhaustion; restart or reduce load\n  } else throw e;\n}","preventionTips":["Reuse effect state across frames rather than re-allocating WebGL objects each frame.","Monitor gl.isContextLost() in long render jobs.","Keep concurrent WebGL2 effect count within the GPU's object budget."],"tags":["webgl","halftone-linear-gradient","gpu-resources","context-loss","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}