{"record":{"id":"098b393ac3222321","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-098b39","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/speckle.ts","lineNumber":242,"sourceCode":"\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, SPECKLE_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":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/speckle.ts#L224-L260","documentation":"After binding the VAO, the speckle() setup calls gl.createBuffer() for the quad vertex data; if it returns null the effect throws 'Failed to create WebGL buffer'. A null VBO means the context is lost or out of buffer resources, so there is nowhere to upload the Float32Array geometry and setup aborts.","triggerScenarios":"Context loss or buffer-object exhaustion during the speckle setup; hitting a driver-imposed buffer-object limit with many live WebGL2 effects allocating geometry simultaneously.","commonSituations":"Many parallel renders each using multiple WebGL2 effects; long-running renders leaking VBOs; software-GPU environments with low buffer caps; driver crash/reset between VAO and buffer creation.","solutions":["Force ANGLE (--gl=angle / chromiumOptions.gl='angle' / Studio OpenGL=angle).","Lower render concurrency and reduce simultaneous WebGL2 effects.","Ensure gl.deleteBuffer runs on cleanup so buffers are recycled.","Render on a machine with adequate GPU resources and supported drivers."],"exampleFix":"// before\nawait renderMedia({ composition, serveUrl, chromiumOptions: {} });\n// after\nawait renderMedia({ composition, serveUrl, chromiumOptions: { gl: 'angle' } });","handlingStrategy":"try-catch","validationCode":"function webgl2Available(): boolean {\n  try {\n    return !!document.createElement('canvas').getContext('webgl2');\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renderMedia({ composition, codec: 'h264', chromiumOptions: { gl: 'angle' } });\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL buffer/.test(err.message)) {\n    console.error('speckle() VBO allocation failed (context lost/exhausted). Lower concurrency or switch GL backend.', err);\n    throw err;\n  }\n  throw err;\n}","preventionTips":["Render WebGL2 effects with ANGLE and modest concurrency.","Confirm gl.deleteBuffer runs on cleanup to recycle buffers.","Avoid leaking effects whose cleanup never runs.","Render on a host with adequate GPU resources."],"tags":["webgl","gpu","buffer","effects","speckle","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}