{"record":{"id":"77e5a223af3b6baa","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-77e5a2","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/thermal-vision.ts","lineNumber":252,"sourceCode":"\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, THERMAL_VISION_VS, THERMAL_VISION_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 colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;\n\tcolorCanvas.height = 1;\n\tconst colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/thermal-vision.ts#L234-L270","documentation":"During thermal vision effect `setup`, `gl.createBuffer()` returned `null` while allocating the vertex buffer for the fullscreen quad. The GL context cannot allocate a buffer object, usually due to context loss or resource exhaustion. The VAO has been created and bound when this fires.","triggerScenarios":"Context lost after VAO creation; GPU buffer memory exhausted; degraded/destroyed GL context.","commonSituations":"Many concurrent webgl2 effects; memory-constrained mobile devices; long-running sessions; headless CI with limited GL memory.","solutions":["Reduce concurrent webgl2 effect instances.","Restart the session for a fresh context.","Ensure adequate GPU memory (close other GPU-heavy apps).","Handle `webglcontextlost` events and reinitialize effect state."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  thermalVision({...params});\n} catch (e) {\n  if (/Failed to create WebGL buffer/.test((e as Error).message)) {\n    renderFallbackFrame();\n  } else throw e;\n}","preventionTips":["Cap concurrent webgl2 effects to bound GL buffer allocation.","Handle context-loss events and recreate buffer state.","Ensure `cleanup` deletes buffers so they are not leaked."],"tags":["thermal-vision","webgl2","gpu","resource-exhaustion","context-lost","buffer","setup"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}