{"record":{"id":"111162bb91bca85e","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-111162","errorCode":null,"errorMessage":"Failed to create WebGL texture","messagePattern":"Failed to create WebGL texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/pattern.ts","lineNumber":495,"sourceCode":"\t\tif (!vbo) {\n\t\t\tthrow new Error('Failed to create WebGL buffer');\n\t\t}\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vbo);\n\t\tgl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);\n\n\t\tconst aPos = gl.getAttribLocation(program, 'aPos');\n\t\tconst aUv = gl.getAttribLocation(program, 'aUv');\n\t\tgl.enableVertexAttribArray(aPos);\n\t\tgl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);\n\t\tgl.enableVertexAttribArray(aUv);\n\t\tgl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);\n\n\t\tgl.bindVertexArray(null);\n\n\t\tconst texture = gl.createTexture();\n\t\tif (!texture) {\n\t\t\tthrow new Error('Failed to create WebGL texture');\n\t\t}\n\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(gl.TEXTURE_2D, null);\n\n\t\treturn {\n\t\t\tgl,\n\t\t\tprogram,\n\t\t\tvao,\n\t\t\tvbo,\n\t\t\ttexture,\n\t\t\tuniforms: {\n\t\t\t\tuSource: gl.getUniformLocation(program, 'uSource'),\n\t\t\t\tuResolution: gl.getUniformLocation(program, 'uResolution'),","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pattern.ts#L477-L513","documentation":"pattern() allocates a texture to receive the source image. gl.createTexture() returns null when the context is lost or the driver refuses the allocation (e.g. texture limits hit). This guard fails before bindTexture/texParameteri would operate on null.","triggerScenarios":"Reached in pattern()'s initializer after the VAO/VBO are set up and unbound. gl.createTexture() returns null due to context loss or because the composition has exhausted the driver's texture budget.","commonSituations":"Compositions with many image/effect layers exceeding texture limits; context loss during render; headless GPU with a low texture cap; long-running Studio sessions.","solutions":["Keep a live WebGL2 context (handle webglcontextlost/restored).","Reduce the number of textures loaded simultaneously in the composition.","Lower source image resolutions where possible.","Use a GPU/SwiftShader backend with adequate texture limits in headless rendering."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  initPattern(canvas); // allocates the source texture\n} catch (err) {\n  if (isContextLost(canvas)) waitForRestore(canvas).then(initPattern);\n  else throw err;\n}","preventionTips":["Keep a live WebGL2 context (handle webglcontextlost/restored).","Reduce the number of simultaneously loaded textures in the composition.","Lower source image resolutions to stay within the GPU texture budget.","Use a headless backend with adequate texture limits (SwiftShader or real GPU)."],"tags":["webgl","gpu","texture","pattern-effect","context-loss","rendering"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}