{"record":{"id":"7eb0f3db11250115","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-7eb0f3","errorCode":null,"errorMessage":"Failed to create WebGL buffer","messagePattern":"Failed to create WebGL buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/gridlines.ts","lineNumber":450,"sourceCode":"\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, GRIDLINES_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":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/gridlines.ts#L432-L468","documentation":"Thrown during Gridlines setup when gl.createBuffer() returns null. The buffer holds the fullscreen-quad vertex data. A null return means the context cannot allocate another buffer object — context loss or resource exhaustion.","triggerScenarios":"Called once per setup right after binding the VAO (gridlines.ts:448). Lost WebGL2 context or leaked buffers exhausting the driver's object budget.","commonSituations":"Leaked buffer objects from repeated setup without cleanup; many concurrent WebGL effects; GPU reset; constrained software renderer.","solutions":["Handle context loss and rebuild state on restore.","Ensure cleanup() deletes buffers (the Gridlines cleanup deletes vbo).","Limit concurrent WebGL2 effects/compositions.","Restart browser/GPU; update drivers if persistent."],"exampleFix":"// before: setup per render, no teardown\nconst state = gridlines.setup(canvas); // buffers leak\n\n// after: setup once, cleanup on unmount\nuseEffect(() => {\n  const state = gridlines.setup(canvas);\n  return () => gridlines.cleanup(state);\n}, []);","handlingStrategy":"try-catch","validationCode":"if (gl.isContextLost()) {\n  throw new Error('WebGL2 context lost; cannot create buffer');\n}","typeGuard":"null","tryCatchPattern":"try {\n  gridlines.setup(canvas);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL buffer') {\n    // context loss / buffer budget exhausted\n  }\n  throw e;\n}","preventionTips":["Pair setup() with cleanup() so buffers are deleted.","Handle context loss and recreate on restore.","Reduce concurrent WebGL effects.","Restart browser/GPU if allocation failures persist."],"tags":["webgl","gridlines-effect","buffer","gpu","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}