{"record":{"id":"76ced66035b2033c","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-76ced6","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/shine.ts","lineNumber":270,"sourceCode":"\t\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, SHINE_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":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/shine.ts#L252-L288","documentation":"The shine() effect's setup function calls gl.createBuffer() to allocate a VBO for the fullscreen quad vertices. If the WebGL2 driver returns null, the effect throws this Error. A null buffer means GPU memory allocation failed even though the context was successfully created.","triggerScenarios":"Calling shine() when GPU memory is exhausted or the driver is in a degraded state. Common in headless renderers using software GL, or when many WebGL2 effects are live simultaneously.","commonSituations":"SwiftShader-based CI environments with limited allocation capacity; Remotion Lambda with insufficient Chrome/GPU layer; rendering at very large resolutions that stress the software rasterizer; leaked buffer objects from improperly cleaned-up effect instances.","solutions":["Verify GPU acceleration is enabled in the render environment.","Reduce concurrency so fewer WebGL2 contexts and buffers are live at once.","Ensure proper effect cleanup to release GPU buffers between renders.","Use a runner or Lambda configuration with adequate GPU resources."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// Probe buffer allocation capability\nfunction canCreateGlBuffer(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  shine({ progress: 0.5 });\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL buffer') {\n    console.warn('WebGL2 buffer allocation failed');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Reduce concurrency to limit simultaneous GPU buffer allocations.","Ensure proper effect cleanup to release buffers.","Verify GPU acceleration in the render environment.","Monitor for context-loss events."],"tags":["webgl2","gpu","resource-allocation","buffer","memory"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}