{"record":{"id":"25ea2658c76c543a","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer","errorCode":null,"errorMessage":"Failed to create WebGL buffer","messagePattern":"Failed to create WebGL buffer","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/brand/src/effects/metallic-swirl-effect.ts","lineNumber":563,"sourceCode":"\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);\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":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L545-L581","documentation":"In the `setup` callback, `gl.createBuffer()` returned `null`. WebGL2 returns null on context loss or resource exhaustion; the vertex array was created just before this, so it is an environment/resource failure. The buffer holds the fullscreen-quad vertex data.","triggerScenarios":"WebGL2 context lost mid-setup; GPU buffer/object limit reached after many effects; software WebGL2 backend that cannot allocate buffers; driver instability.","commonSituations":"Many simultaneous WebGL2 effects; leaked buffers across remounts; long sessions; under-resourced or virtualized GPUs.","solutions":["Reduce the number of simultaneously mounted WebGL2 effects.","Ensure effects are unmounted/disposed so GL resources are freed.","Update GPU drivers / use a hardware-accelerated browser.","Verify the WebGL2 context is healthy before mounting many effects."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const supportsWebGL2 = (): boolean => {\n  try {\n    const c = document.createElement('canvas');\n    return !!c.getContext('webgl2');\n  } catch {\n    return false;\n  }\n};","typeGuard":"const hasHealthyWebGL2 = (canvas: HTMLCanvasElement): boolean => {\n  const gl = canvas.getContext('webgl2');\n  return !!gl && !gl.isContextLost();\n};","tryCatchPattern":"try {\n  metallicSwirl({speed: 1})(...);\n} catch (err) {\n  if (err instanceof Error && /Failed to create WebGL buffer/.test(err.message)) {\n    // reduce effect count or fall back\n  } else {\n    throw err;\n  }\n}","preventionTips":["Limit simultaneously mounted WebGL2 effects to avoid exhausting buffer slots.","Dispose/unmount effects so GL objects are freed between sequences.","Use a hardware-accelerated browser with current GPU drivers.","Recover on 'webglcontextlost' events."],"tags":["brand","metallic-swirl","webgl","gpu","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}