hermes - 💡(How to fix) Fix TUI: Node.js OOM crash when agent uses browser tools repeatedly

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

The TUI (Ink/React terminal UI) crashes silently with "gateway exited" when the agent performs multiple browser tool calls (navigate + snapshot). The Node.js process dies without any error output 鈥?no stderr, no stack trace, no OOM message. CLI mode handles the exact same scenario without any issue.

Error Message

The TUI (Ink/React terminal UI) crashes silently with "gateway exited" when the agent performs multiple browser tool calls (navigate + snapshot). The Node.js process dies without any error output 鈥?no stderr, no stack trace, no OOM message. CLI mode handles the exact same scenario without any issue.

  • Or at minimum, logging an error before exiting
  • No error message in stderr or logs
  1. Add memory monitoring for tool output accumulation 鈥?detect when tool output memory exceeds a threshold and warn/compact

Root Cause

The Ink renderer in the TUI creates virtual DOM nodes for every tool output. Browser snapshots return large DOM trees (10-50KB each). The virtual DOM accumulates memory that is never released, causing Node.js heap to grow until it crashes.

Key indicators:

  • Memory grows linearly with browser tool calls
  • No memory plateau 鈥?it keeps growing
  • --max-old-space-size=8192 is set via NODE_OPTIONS but doesn't help (crash happens at ~244MB, well below 8GB)
  • The crash is silent 鈥?no memory critical event from the memory monitor (threshold is 2.5GB)

Fix Action

Workaround

Use CLI mode (hermes without --tui) for tasks that involve extensive browser tool usage. CLI mode handles the same workload without memory issues.

Code Example

Visit https://github.com and take a snapshot, then visit https://news.ycombinator.com and take a snapshot, then visit https://reddit.com and take a snapshot
RAW_BUFFERClick to expand / collapse

Bug: TUI crashes silently when agent uses browser tools repeatedly

Description

The TUI (Ink/React terminal UI) crashes silently with "gateway exited" when the agent performs multiple browser tool calls (navigate + snapshot). The Node.js process dies without any error output 鈥?no stderr, no stack trace, no OOM message. CLI mode handles the exact same scenario without any issue.

Reproduction Steps

  1. Start TUI: hermes --tui
  2. Ask agent to browse multiple websites using browser tools:
    Visit https://github.com and take a snapshot, then visit https://news.ycombinator.com and take a snapshot, then visit https://reddit.com and take a snapshot
  3. Wait 5-10 minutes while the agent executes browser navigate + snapshot calls
  4. TUI crashes with "gateway exited"

Expected Behavior

The TUI should handle browser tool outputs gracefully, either by:

  • Truncating large tool output before rendering
  • Virtualizing the Ink rendering of large outputs
  • Or at minimum, logging an error before exiting

Actual Behavior

  • Node.js process dies silently (exit code 1)
  • No error message in stderr or logs
  • tui_gateway_crash.log shows: reason=stdin EOF (TUI closed the command pipe)
  • No segfault in dmesg, no OOM kill

Evidence

Crash 1 (real session):

  • 637 messages, 1.3MB session, 275 tool outputs
  • Largest tool output: 49KB (session_search result)
  • Node.js memory grew to 244MB before crash
  • Runtime: ~20 minutes

Crash 2 (reproduced):

  • 2 messages only, fresh TUI session
  • Agent executed 3+ browser navigate + snapshot calls
  • Node.js memory: 115MB 鈫?244MB (112% growth) before crash
  • Runtime: 7 minutes 39 seconds

CLI comparison:

  • Same browser tool operations in CLI mode: zero crashes
  • CLI handles 5000+ messages without issue

Root Cause Analysis

The Ink renderer in the TUI creates virtual DOM nodes for every tool output. Browser snapshots return large DOM trees (10-50KB each). The virtual DOM accumulates memory that is never released, causing Node.js heap to grow until it crashes.

Key indicators:

  • Memory grows linearly with browser tool calls
  • No memory plateau 鈥?it keeps growing
  • --max-old-space-size=8192 is set via NODE_OPTIONS but doesn't help (crash happens at ~244MB, well below 8GB)
  • The crash is silent 鈥?no memory critical event from the memory monitor (threshold is 2.5GB)

Environment

  • Hermes Agent: v0.14.0 (2026.5.16)
  • Node.js: v24.15.0
  • OS: WSL2 (Ubuntu 24.04) on Windows 11, NAT networking mode
  • Terminal: Windows Terminal (xterm-256color)
  • TUI startup: hermes --tui (default settings)

Suggested Fix

  1. Truncate large tool outputs before Ink rendering 鈥?cap tool output display at ~4KB per message, with expandable detail
  2. Add memory monitoring for tool output accumulation 鈥?detect when tool output memory exceeds a threshold and warn/compact
  3. Use virtualized rendering for tool output 鈥?only render visible portions of large tool outputs

Workaround

Use CLI mode (hermes without --tui) for tasks that involve extensive browser tool usage. CLI mode handles the same workload without memory issues.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING