{"record":{"id":"dd52a8d0d69231b5","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-dd52a8","errorCode":null,"errorMessage":"Failed to create WebGL texture","messagePattern":"Failed to create WebGL texture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/effects/src/lines.ts","lineNumber":362,"sourceCode":"\tgl: WebGL2RenderingContext,\n\tvertexSource: string,\n\tfragmentSource: string,\n): WebGLProgram => {\n\tconst vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);\n\tconst fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);\n\tconst program = linkProgram(gl, vs, fs);\n\tgl.deleteShader(vs);\n\tgl.deleteShader(fs);\n\treturn program;\n};\n\nconst createTexture = (\n\tgl: WebGL2RenderingContext,\n\tfilter: number,\n): WebGLTexture => {\n\tconst texture = gl.createTexture();\n\tif (!texture) {\n\t\tthrow new Error('Failed to create WebGL texture');\n\t}\n\n\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\tgl.bindTexture(gl.TEXTURE_2D, null);\n\treturn texture;\n};\n\nconst setupLines = (target: HTMLCanvasElement): LinesState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/lines.ts#L344-L380","documentation":"A plain Error thrown by createTexture in the Lines effect when gl.createTexture() returns null. The Lines effect uses two textures (a LINEAR source texture and a NEAREST palette texture); if either allocation returns null, setup aborts.","triggerScenarios":"WebGL2 context is alive but cannot allocate another texture object — GPU memory exhaustion, a lost context, or an excessive number of live textures across the page. Triggered from setupLines via createTexture(gl, gl.LINEAR) and createTexture(gl, gl.NEAREST).","commonSituations":"Many concurrent renders, large source frames being uploaded repeatedly, or a GPU memory leak that saturates texture capacity. Headless software GL with a small texture budget.","solutions":["Reduce concurrency / parallel browser contexts.","Ensure prior effects are cleaning up their GL resources (the Lines effect tears down on cleanup).","Render on a host with more GPU memory or a more capable GL backend."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function canAllocateTexture(): boolean {\n  const c = document.createElement('canvas');\n  const gl = c.getContext('webgl2');\n  if (!gl) return false;\n  return !!gl.createTexture();\n}","typeGuard":null,"tryCatchPattern":"try {\n  lines(...);\n} catch (err) {\n  if (err instanceof Error && /WebGL texture/.test(err.message)) {\n    // reduce concurrency / free textures, then retry\n  } else throw err;\n}","preventionTips":["Dispose of finished effects/contexts so textures are reclaimed.","Lower render concurrency to stay within GPU texture limits.","Use a render host with sufficient GPU memory."],"tags":["webgl2","lines-effect","gpu","texture","resource-exhaustion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}