NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

Installer accepts gateway port 11438, then the CLI refuses to start

Open udsy19 opened this issue 3 months ago • 0 comments

Investigation Summary

  • The scripts/install.sh reserved-port guard lists 8000, 8081, 11434, 11435, 11436, and 11437, but not the HTTPS Pin Runtime adapter default 11438.
  • The follow-up loop in the same function compares the gateway port against the configured NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT, so it hides the gap only while that adapter keeps its default.
  • With the adapter moved to another port, resolve_nemoclaw_gateway_port accepts 11438 and the installer writes ~/.nemoclaw/gateways/11438/usage-notice.json.
  • validateServicePort in src/lib/core/ports.ts rejects every reserveDefault entry regardless of the configured adapter port, so GATEWAY_PORT throws at module load and every nemoclaw command exits 1.
  • docs/reference/commands.mdx already documents 11438 as a reserved default, so the installer is the side that drifted.

Description

The installer guard for NEMOCLAW_GATEWAY_PORT exists to fail before the installer writes host state. It does that for every reserved inference and runtime-adapter default except 11438.

When NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT holds a port other than 11438, the installer accepts NEMOCLAW_GATEWAY_PORT=11438, creates ~/.nemoclaw/gateways/11438, records the usage-notice acceptance, and continues through Node.js and OpenShell installation and onboarding.

The CLI then rejects that same port at module load. Every nemoclaw invocation exits 1, including nemoclaw debug --quick. The host is left with installed state for a gateway port the CLI will not accept.

Expected: the installer rejects NEMOCLAW_GATEWAY_PORT=11438 before it writes host state, as it does for 11434, 11436, and 11437.

Reproduction Steps

The guard runs inside resolve_nemoclaw_gateway_port, so the reproduction sources install.sh and calls the guard and the first state-writing function directly. This isolates the defect without a full host install.

  1. Check out main at 7d516f2ed.

  2. Show that the sibling reserved defaults reject a gateway port even when their own adapter is moved:

    H=$(mktemp -d)
    env -i HOME="$H" PATH="$PATH" bash -c '
      source scripts/install.sh >/dev/null
      NEMOCLAW_OPENROUTER_RUNTIME_ADAPTER_PORT=11500
      NEMOCLAW_GATEWAY_PORT=11437
      resolve_nemoclaw_gateway_port'
    echo "exit=$?"
    
  3. Run the same shape for 11438:

    env -i HOME="$H" PATH="$PATH" bash -c '
      source scripts/install.sh >/dev/null
      NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT=11500
      NEMOCLAW_GATEWAY_PORT=11438
      save_usage_notice_acceptance_shell "v0.0.110"'
    echo "exit=$?"
    find "$H/.nemoclaw"
    
  4. Run any CLI command with the same environment:

    NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT=11500 NEMOCLAW_GATEWAY_PORT=11438 nemoclaw --version
    echo "exit=$?"
    

Step 2 exits 1 and writes nothing. Step 3 exits 0 and writes host state. Step 4 exits 1.

Environment

  • OS: macOS 26.5.1 (Darwin 25.5.0), Apple silicon
  • Hardware: Apple silicon workstation
  • Node.js: v22
  • Docker: not required for this reproduction
  • NemoClaw: v0.0.109-151-g7d516f2ed (main at 7d516f2ed)

Debug Output

nemoclaw debug --quick cannot produce a bundle here, because the failure occurs while the CLI evaluates its port module. The command exits 1 with the same message:

$ NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT=11500 NEMOCLAW_GATEWAY_PORT=11438 nemoclaw debug --quick
Error: Invalid port: NEMOCLAW_GATEWAY_PORT="11438" — must not overlap the HTTPS Pin Runtime adapter default port (11438)
$ echo $?
1

With no gateway-port override, the same build reports its version normally:

$ nemoclaw --version
nemoclaw v0.0.109-151-g7d516f2ed

Logs

Guard behavior for 11438 and its siblings on main at 7d516f2ed:

# sibling defaults, adapter moved off its default -- all rejected
$ NEMOCLAW_OLLAMA_PORT=11500 NEMOCLAW_GATEWAY_PORT=11434 ...
exit=1  [ERROR] NEMOCLAW_GATEWAY_PORT must not overlap a reserved inference or runtime-adapter port (11434).
$ NEMOCLAW_BEDROCK_RUNTIME_ADAPTER_PORT=11500 NEMOCLAW_GATEWAY_PORT=11436 ...
exit=1  [ERROR] NEMOCLAW_GATEWAY_PORT must not overlap a reserved inference or runtime-adapter port (11436).
$ NEMOCLAW_OPENROUTER_RUNTIME_ADAPTER_PORT=11500 NEMOCLAW_GATEWAY_PORT=11437 ...
exit=1  [ERROR] NEMOCLAW_GATEWAY_PORT must not overlap a reserved inference or runtime-adapter port (11437).

# 11438, adapter moved off its default -- accepted
$ NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT=11500 NEMOCLAW_GATEWAY_PORT=11438 ...
exit=0  11438

# 11438, adapter left at its default -- rejected by the configured-port loop, not the reserved-port guard
$ NEMOCLAW_GATEWAY_PORT=11438 ...
exit=1  [ERROR] NEMOCLAW_GATEWAY_PORT conflicts with NEMOCLAW_HTTPS_PIN_RUNTIME_ADAPTER_PORT (11438).

Host state written by the accepted case:

$HOME/.nemoclaw
$HOME/.nemoclaw/gateways
$HOME/.nemoclaw/gateways/11438
$HOME/.nemoclaw/gateways/11438/usage-notice.json

Checklist

  • [x] I confirmed this bug is reproducible
  • [x] I searched existing issues and this is not a duplicate

udsy19 avatar Aug 18 '26 06:08 udsy19