{"record":{"id":"9745d48ce90b816b","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-9745d4","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/contour-lines.ts","lineNumber":446,"sourceCode":"\n\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);\n\n\tconst program = createProgram(gl, CONTOUR_LINES_VS, CONTOUR_LINES_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":428,"sourceCodeEnd":464,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/contour-lines.ts#L428-L464","documentation":"Thrown in setupContourLines when gl.createBuffer() returns null. The WebGL2 context was acquired but could not allocate a buffer object for the vertex data. This is a GPU resource exhaustion or context-loss issue, not a user parameter problem.","triggerScenarios":"During contour-lines effect initialization, after VAO creation, gl.createBuffer() returns null when allocating the fullscreen-quad vertex buffer.","commonSituations":"GPU resource exhaustion from many simultaneous effects; context lost between VAO and buffer creation; constrained software WebGL in CI/VM/headless environments.","solutions":["Reduce the number of simultaneously active WebGL effects.","Check gl.isContextLost() before and during setup.","Use a rendering environment with adequate GPU resources.","Implement webglcontextlost handling to reinitialize."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify WebGL2 context health before effect setup\nconst gl = target.getContext('webgl2');\nif (gl?.isContextLost()) {\n  // defer or skip\n}","typeGuard":null,"tryCatchPattern":"try {\n  contourLines({...})(source, target);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create WebGL buffer') {\n    // GPU resource issue — reduce concurrent effects\n  }\n  throw e;\n}","preventionTips":["Reduce the number of simultaneously active WebGL effects.","Check gl.isContextLost() during setup.","Use a rendering environment with adequate GPU resources.","Handle webglcontextlost to reinitialize."],"tags":["webgl","effects","contour-lines","gpu","resource-exhaustion","buffer"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}