{"record":{"id":"4d04c81bdc75608f","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-4d04c8","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.ts","lineNumber":441,"sourceCode":"\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, HALFTONE_FS);\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":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/halftone.ts#L423-L459","documentation":"Thrown in setup() of the halftone effect when gl.createBuffer() returns null. The effect needs a vertex buffer for the fullscreen-quad attributes; null means the GL implementation would not allocate another buffer object — object-budget exhaustion or context loss.","triggerScenarios":"Halftone setup() running after the VAO succeeded but with the buffer pool already exhausted; or under context-loss conditions.","commonSituations":"Long render jobs with many WebGL2 effects; integrated GPUs under load; post-crash context.","solutions":["Check gl.isContextLost(); restart the render if true.","Lower the count of WebGL2 effects or share effect state.","Render on a machine with more GPU headroom / a newer driver.","Restart Chrome/Studio to clear leaked GL objects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function 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 halftone()\n} catch (e) {\n  if (e instanceof Error && /Failed to create WebGL buffer/.test(e.message)) {\n    // buffer budget exhausted or context lost; restart render\n  } else throw e;\n}","preventionTips":["Reuse effect state across frames instead of re-creating buffers each frame.","Monitor gl.isContextLost() in long render jobs.","Keep concurrent WebGL2 effect count within the GPU's object budget."],"tags":["webgl","halftone","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"}