{"record":{"id":"bd488146426cbec1","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-bd4881","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/color-key.ts","lineNumber":283,"sourceCode":"\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, COLOR_KEY_VS, COLOR_KEY_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 textureSource = createRgbaTexture(gl);\n\n\tconst colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/color-key.ts#L265-L301","documentation":"Thrown by setupColorKey when gl.createBuffer() returns null after the VAO was created and bound. The GL context cannot allocate a vertex buffer object, indicating resource/memory exhaustion or context loss. Without the VBO the fullscreen-quad vertex data cannot be uploaded, so setup aborts.","triggerScenarios":"At color-key.ts:283 inside setupColorKey, after the VAO is created and bound. gl.createBuffer() returns null under GL object/memory pressure or a lost context; not parameter-driven.","commonSituations":"High render concurrency, software GL with low buffer limits, GPU memory pressure, or context loss during a long render.","solutions":["Reduce render concurrency so fewer GL buffers are live.","Use a GPU-enabled render environment instead of software GL.","Update drivers/Chrome and retry for transient context loss.","Fewer stacked WebGL effects per render lowers buffer allocation."],"exampleFix":"// before\nremotion render main --concurrency=8\n\n// after\nremotion render main --concurrency=1","handlingStrategy":"retry","validationCode":"function webgl2BufferAvailable(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl) return false;\n    const b = gl.createBuffer();\n    const ok = b !== null;\n    if (b) gl.deleteBuffer(b);\n    return ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renderMedia({...});\n} catch (err) {\n  if (/Failed to create WebGL buffer/i.test(String(err))) {\n    await renderMedia({...opts, concurrency: 1});\n  } else {\n    throw err;\n  }\n}","preventionTips":["Reduce render concurrency to keep live GL buffer objects low.","Render with GPU acceleration rather than software GL.","Update drivers/Chromium; retry on transient context loss.","Fewer WebGL effects per frame lowers buffer allocation."],"tags":["webgl","gpu-resource-exhaustion","color-key","vertex-buffer","rendering","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}