{"record":{"id":"e04db251ab9d361a","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-e04db2","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/duotone.ts","lineNumber":190,"sourceCode":"};\n\nconst createProgram = (\n\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 createRgbaTexture = (gl: WebGL2RenderingContext): 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, gl.LINEAR);\n\tgl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\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 setupDuotone = (target: HTMLCanvasElement): DuotoneState => {\n\tconst gl = target.getContext('webgl2', {\n\t\tpremultipliedAlpha: true,\n\t\talpha: true,\n\t\tpreserveDrawingBuffer: true,\n\t});\n\tif (!gl) {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/duotone.ts#L172-L208","documentation":"Thrown by duotone's createRgbaTexture() when gl.createTexture() returns null. The program and vertex array already succeeded, so the context exists; a null texture means the driver could not allocate another texture object, again indicating context loss or resource exhaustion.","triggerScenarios":"Occurs during setupDuotone() when allocating the source texture that will receive each frame's pixel data. Triggered when the GPU texture-object budget is exhausted or the context is lost after the VAO was created.","commonSituations":"Many concurrent GPU-effect frames, a frame with many textures in flight, a GPU process crash, or a sandboxed headless Chrome with constrained texture memory.","solutions":["Render with a software backend: `npx remotion render <comp> --gl=swiftshader`.","Lower render concurrency to reduce simultaneous texture allocation.","Restart the render worker / relaunch Chrome to recover a lost context.","Update GPU drivers / Chromium."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function safeRender(opts) {\n  try {\n    return await renderMedia(opts);\n  } catch (err) {\n    if (/Failed to create WebGL texture/.test(String(err?.message ?? ''))) {\n      return await renderMedia({...opts, gl: 'swiftshader', concurrency: 1});\n    }\n    throw err;\n  }\n}","preventionTips":["Reduce concurrency to lower simultaneous texture allocation pressure.","Prefer a software GL backend in constrained/headless environments.","Restart the render worker if you suspect a leaked/lost context.","Keep GPU drivers / Chromium updated."],"tags":["webgl","gpu","rendering","effects","runtime"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}