{"record":{"id":"ae7e8e1dc5a90b29","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-ae7e8e","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/noise.ts","lineNumber":215,"sourceCode":"\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, NOISE_FS);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(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 texture = gl.createTexture();\n\tif (!texture) {\n\t\tthrow new Error('Failed to create WebGL texture');\n\t}","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/noise.ts#L197-L233","documentation":"Thrown by setupNoise (packages/effects/src/noise.ts:215) when gl.createBuffer() returns null while allocating the quad vertex buffer for the noise effect. Null indicates a lost WebGL2 context or exhausted buffer/GPU-memory budget.","triggerScenarios":"Applying noise() when the context is lost or GPU memory is full; many concurrent noise/WebGL2 effects past the per-context buffer limit.","commonSituations":"GPU-less headless CI under SwiftShader pressure; leaked buffers across a long session; GPU process crash during render.","solutions":["Ensure gl.deleteBuffer runs in cleanup between compositions and cap concurrent WebGL2 effects.","Render on a GPU host with WebGL enabled in headless Chrome.","Handle 'webglcontextlost' and re-render after restore."],"exampleFix":"// before\nconst vbo = gl.createBuffer(); // null -> throws\n\n// after\nif (gl.isContextLost()) {\n  throw new Error('WebGL2 context lost; cannot create noise buffer');\n}","handlingStrategy":"try-catch","validationCode":"function canCreateNoiseBuffer(): boolean {\n  try {\n    const c = document.createElement('canvas');\n    const gl = c.getContext('webgl2');\n    if (!gl || gl.isContextLost()) return false;\n    const b = gl.createBuffer();\n    const ok = !!b;\n    if (b) gl.deleteBuffer(b);\n    return ok;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  scene.push(noise({amount: 0.2}));\n} catch (err) {\n  if (/Failed to create WebGL buffer/.test(String(err?.message))) {\n    // buffer budget exhausted or context lost: omit the effect\n  } else throw err;\n}","preventionTips":["Delete buffers via cleanup between compositions.","Cap concurrent WebGL2 effects.","Render on a GPU host and handle context-loss events."],"tags":["webgl","gpu","noise","effects","buffer","context-loss"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}