{"record":{"id":"b4080202edbd2333","repo":"remotion-dev/remotion","slug":"failed-to-create-webgl-texture-b40802","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/outline.ts","lineNumber":269,"sourceCode":"\tgl.attachShader(program, vertexShader);\n\tgl.attachShader(program, fragmentShader);\n\tgl.linkProgram(program);\n\tgl.deleteShader(vertexShader);\n\tgl.deleteShader(fragmentShader);\n\n\tif (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n\t\tconst log = gl.getProgramInfoLog(program);\n\t\tgl.deleteProgram(program);\n\t\tthrow new Error(`Outline program link failed: ${log ?? '(no log)'}`);\n\t}\n\n\treturn program;\n};\n\nconst createTexture = (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 updatePolygonMask = ({\n\tsource,\n\twidth,\n\theight,\n\tsimplification,\n\toutlineWidth,\n\tstate,","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/effects/src/outline.ts#L251-L287","documentation":"The outline() effect allocates two textures (source image and polygon mask) via gl.createTexture(); a null return means the WebGL2 context is lost or out of GPU resources. This happens in setupOutline()'s texture creation phase, after program/VAO/VBO setup already succeeded.","triggerScenarios":"Applying outline() when GPU memory is exhausted (many large-format frames with effects in parallel) or after a context-loss event that leaves createTexture returning null.","commonSituations":"High-resolution (4K+) renders at high concurrency; Lambda renders near the memory ceiling; multiple elements with outline() rendered simultaneously in one Chrome instance.","solutions":["Retry the render with lower concurrency and/or a lower resolution scale to cut GPU memory use","Restart the render to obtain a fresh context","Reduce the number of outline()-decorated elements mounted at the same time","Update Chrome/GPU drivers if the error is persistent on one machine"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await renderMediaOnLambda(/* ... */);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to create WebGL texture') {\n    await renderMediaOnLambda(/* ..., concurrency: 2 */); // GPU memory pressure: retry lighter\n  } else {\n    throw err;\n  }\n}","preventionTips":["Match Lambda memory size to output resolution when using outline()","Avoid many simultaneous high-resolution outlined elements in one composition","Retry renders automatically - texture allocation failures are usually transient"],"tags":["remotion","effects","webgl","context-lost","texture","outline","gpu-memory"],"backgroundTag":"webgl-context-lost","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}