{"record":{"id":"4b5f1810b3933340","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-buffer-4b5f18","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/pixelate.ts","lineNumber":143,"sourceCode":"\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);\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":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pixelate.ts#L125-L161","documentation":"Thrown by createPixelateState when gl.createBuffer() returns null after the VAO was created and bound. The null-check aborts before bindBuffer/bufferData would silently no-op on a missing buffer. Cause is GL buffer-object allocation failure, typically context loss or memory pressure.","triggerScenarios":"pixelate setup: VAO succeeded, then gl.createBuffer() in createPixelateState returns null.","commonSituations":"GPU memory pressure from large source textures; context loss mid-setup; SwiftShader under load on Lambda; many effects holding buffers simultaneously.","solutions":["Check `gl.isContextLost()` and remount on restore.","Reduce concurrent WebGL2 effects and free unused source assets.","Increase Lambda function memory.","Render at a lower resolution to reduce per-frame buffer traffic.","Reproduce locally to rule out the user machine."],"exampleFix":"// before\nimport {pixelate} from '@remotion/effects';\nconst effect = pixelate();\n\n// after — probe buffer allocation\nfunction glCanCreateBuffer(gl: WebGL2RenderingContext): boolean {\n  if (gl.isContextLost()) return false;\n  const b = gl.createBuffer();\n  const ok = b !== null;\n  if (b) gl.deleteBuffer(b);\n  return ok;\n}","handlingStrategy":"try-catch","validationCode":"function glCanCreateBuffer(gl: WebGL2RenderingContext): boolean {\n  if (gl.isContextLost()) return false;\n  const b = gl.createBuffer();\n  if (b) gl.deleteBuffer(b);\n  return b !== null;\n}","typeGuard":null,"tryCatchPattern":"try {\n  pixelate();\n} catch (err) {\n  if (/Failed to create WebGL buffer/.test((err as Error).message)) {\n    // reduce GPU load and retry\n  }\n  throw err;\n}","preventionTips":["Free unused source assets before applying effects.","Keep concurrent WebGL2 effects low.","Render at lower resolution to reduce buffer traffic.","Monitor gl.isContextLost() each pass."],"tags":["webgl","gpu","pixelate","buffer","memory","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}