hermes - ✅(Solved) Fix [Bug]: `hermes --tui` fails with `--expose-gc is not allowed in NODE_OPTIONS` [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

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…
GitHub stats
NousResearch/hermes-agent#17187Fetched 2026-04-29 06:36:50
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×4cross-referenced ×1

Error Message

When running hermes --tui, the process immediately fails with an error related to --expose-gc being disallowed in NODE_OPTIONS. the error still occurs.

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #17200: fix(tui): pass --expose-gc as a node CLI flag, not via NODE_OPTIONS (#17187)

Description (problem / solution / changelog)

Summary

  • hermes --tui immediately exits with --expose-gc is not allowed in NODE_OPTIONS on Node ≥ 20 because the launcher set NODE_OPTIONS="--max-old-space-size=8192 --expose-gc" (added in #13231).
  • Move --expose-gc from the env var onto the node argv inside _make_tui_argv for the two node-direct launch paths. Keep --max-old-space-size=8192 in NODE_OPTIONS, where it's allowed and where user overrides still merge correctly.
  • Adds 4 regression tests (env-var construction + both node-direct argv branches).

The bug

hermes_cli/main.py:1126-1136 (pre-fix) appended --expose-gc to whatever the user had in NODE_OPTIONS:

_tokens = env.get("NODE_OPTIONS", "").split()
if not any(t.startswith("--max-old-space-size=") for t in _tokens):
    _tokens.append("--max-old-space-size=8192")
if "--expose-gc" not in _tokens:
    _tokens.append("--expose-gc")
env["NODE_OPTIONS"] = " ".join(_tokens)

--expose-gc is a V8 flag. Node has an explicit allow-list for NODE_OPTIONS and refuses anything outside it on startup, so the spawned process aborts before the TUI loads:

$ hermes --tui
/home/cimon/.local/bin/node: --expose-gc is not allowed in NODE_OPTIONS

The reporter (#17187) hit this on Ubuntu 24.04 with Node 20.12.2, with their own NODE_OPTIONS empty — the launcher itself was the source. unset NODE_OPTIONS doesn't help because the launcher re-injects the flag every run.

--max-old-space-size=… is on Node's allow-list, which is why the cap added in #13231 still works; only the --expose-gc line trips the rejection.

The fix

_make_tui_argv already returns argv tuples like [node, dist/entry.js] for the two production paths (HERMES_TUI_DIR fast path + built-bundle fallback). V8 flags pass through fine when given on the node CLI, so the patch just inserts --expose-gc between the binary and the script:

return [node, "--expose-gc", str(p / "dist" / "entry.js")], p

…and drops the --expose-gc block from the NODE_OPTIONS construction in _launch_tui. --max-old-space-size=8192 continues to be set via env so the existing user-merge semantics (respect any user-supplied higher cap) are preserved.

The dev paths (tsx src/entry.tsx, npm start) aren't node-direct, so they don't pick up --expose-gc. Those paths are maintainer-only and were already broken on Node 20+ under the old code, so this is a pragmatic trade-off rather than a regression.

Test plan

  • Focused regression test: tests/hermes_cli/test_tui_node_options_expose_gc.py — 4 tests covering the env-var construction in _launch_tui (no --expose-gc injected, user NODE_OPTIONS preserved without double-cap) and both node-direct branches of _make_tui_argv (HERMES_TUI_DIR + built bundle), each asserting --expose-gc lands on argv before the entry script. All 4 pass.
  • Adjacent suite: tests/hermes_cli/test_tui_resume_flow.py, tests/hermes_cli/test_tui_npm_install.py, tests/hermes_cli/test_launcher.py — 17 / 17 pass on this branch.
  • Regression guard: all 4 new tests fail on clean origin/main (188eaa57c) with the exact reporter symptom: AssertionError: --expose-gc must not be injected into NODE_OPTIONS (#17187); got NODE_OPTIONS='--max-old-space-size=8192 --expose-gc'. They pass with the fix applied.

Related

  • Fixes #17187
  • Follow-up to #13231 (which introduced the --expose-gc injection alongside the V8 heap cap).

Changed files

  • hermes_cli/main.py (modified, +9/-9)
  • tests/hermes_cli/test_tui_node_options_expose_gc.py (added, +166/-0)

Code Example

Report     https://paste.rs/Q66VD

---
RAW_BUFFERClick to expand / collapse

Bug Description

When running hermes --tui, the process immediately fails with an error related to --expose-gc being disallowed in NODE_OPTIONS.

Even after explicitly clearing the environment variable:

unset NODE_OPTIONS NODE_OPTIONS="" hermes --tui

the error still occurs.

A search for NODE_OPTIONS or --expose-gc in common install paths did not return any matches, suggesting the value may be injected internally during TUI startup.

This appears to be incompatible with Node.js v20+, where --expose-gc is not allowed via NODE_OPTIONS.

Steps to Reproduce

node -v

v20.12.2

hermes --version

Hermes Agent v0.11.0 (2026.4.23)

hermes --tui

Expected Behavior

Running hermes --tui should start the TUI interface successfully on Node.js v20 as documented, without any startup errors.

Actual Behavior

/home/cimon/.local/bin/node: --expose-gc is not allowed in NODE_OPTIONS

Affected Component

CLI (interactive chat)

Messaging Platform (if gateway-related)

No response

Debug Report

Report     https://paste.rs/Q66VD

Operating System

Ubuntu 24.04

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The issue can be resolved by finding and removing the internal injection of --expose-gc in NODE_OPTIONS within the Hermes TUI startup process.

Guidance

  • Investigate the Hermes TUI startup code to identify where --expose-gc is being injected into NODE_OPTIONS.
  • Consider modifying the Hermes code to remove or conditionally avoid setting --expose-gc when running on Node.js v20+.
  • Verify that the NODE_OPTIONS environment variable is not being set by any other means, such as a shell configuration file or another process.
  • If the issue persists, try setting NODE_OPTIONS to an empty string before running hermes --tui, using a command like NODE_OPTIONS="" hermes --tui, although this has already been attempted.

Example

No code snippet is provided as the issue does not contain sufficient information about the internal workings of the Hermes TUI.

Notes

The root cause of the issue appears to be the incompatibility between Hermes and Node.js v20+, where --expose-gc is no longer allowed in NODE_OPTIONS. However, without access to the Hermes codebase, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by modifying the Hermes code to avoid setting --expose-gc in NODE_OPTIONS when running on Node.js v20+, as this is the most likely cause of the issue.

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