{"record":{"id":"2b7c5ce28110dbd6","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-2b7c5c","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/lines.ts","lineNumber":401,"sourceCode":"\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, LINES_VS, LINES_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 colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;\n\tcolorCanvas.height = 1;\n\tconst colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/lines.ts#L383-L419","documentation":"A plain Error thrown inside setupLines when gl.createBuffer() returns null. This buffer holds the Lines full-screen quad vertex data (positions + uvs); allocation failure means the effect cannot upload geometry and aborts.","triggerScenarios":"WebGL2 context is alive but cannot allocate a buffer object — GPU memory exhaustion or context loss. Reached after the VAO is created and bound, immediately before bufferData with the static quad array.","commonSituations":"Heavy concurrent rendering saturating GPU memory; a leaked context; headless software GL with limited buffer capacity; a context-loss race.","solutions":["Lower render concurrency.","Ensure previous effects/contexts are disposed so buffers are reclaimed.","Render on a host with adequate GPU memory / a stable GL backend."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function canAllocateBuffer(): boolean {\n  const c = document.createElement('canvas');\n  const gl = c.getContext('webgl2');\n  if (!gl) return false;\n  return !!gl.createBuffer();\n}","typeGuard":null,"tryCatchPattern":"try {\n  lines(...);\n} catch (err) {\n  if (err instanceof Error && /WebGL buffer/.test(err.message)) {\n    // free buffers / reduce concurrency, then retry\n  } else throw err;\n}","preventionTips":["Dispose of prior effects/contexts so GL buffers are reclaimed.","Lower render concurrency to keep GPU buffers available.","Use a render host with adequate GPU memory."],"tags":["webgl2","lines-effect","gpu","buffer","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}