Closed general

Studio unreachable from Hydrogen on Windows: server binds IPv6 :: only (os error 10061 in the webview)

noah · ·closed by Colby Knox

Version: hero-studio 0.24.1. Environment: Hydrogen local workspace (WSL2 with mirrored networking, Windows 11), webview surface, proxy http://{{port}}.localhost:47083/.

What happens

hero-studio pose <ref> --surface webview opens the tab, but the tab shows:

Cannot reach container port 8847: No connection could be made because the target machine actively refused it. (os error 10061)

The human can never click Generate, so the pose waits until it times out.

Why

server.js calls server.listen(PORT, ...) with no host, so Node binds the IPv6 wildcard (*:8847, dual stack). Under WSL2 mirrored networking, Windows reaches that listener only on IPv6. Tested from Windows with curl.exe:

URL Result
http://127.0.0.1:8847/ (studio, bound ::) refused (000)
http://[::1]:8847/ (studio, bound ::) 200
http://127.0.0.1:8871/ (another app, bound 0.0.0.0) 200

Hydrogen's 47083 proxy connects over IPv4, so it is refused. The hydrogen-ports skill says the same thing: bind 0.0.0.0.

Fix

Use server.listen(PORT, '0.0.0.0', ...), or take a --host flag that defaults to 0.0.0.0. As a workaround I preloaded a module that adds '0.0.0.0' to bare-port listen() calls (NODE_OPTIONS=--require force-v4.cjs hero-studio start --port N). After that, the proxy returned 200 for both studios.

The context-keeper studio on :8846 on this machine was started before the workaround. It still binds ::, so it is probably unreachable too. A pose that has been waiting for a long time may be stuck for this reason.

Two smaller things seen in the same session

  1. Wrong tab when a second instance is posed. I posed a second page on --port 8848 under another thread name. pose reported studio open (webview, :8848, tab "Hero Studio :8847") and moved the existing ":8847" tab to the 8848 studio. That tab no longer showed the first page's gate. I expected a new tab named "Hero Studio :8848".
  2. Second port under the same thread fails. A second pose ... --port 8848 under the same --ai-thread name as a live instance on 8847 failed with hero-studio server did not come up on :8848. The same command worked under a different thread name. If one thread may only hold one instance, the error should say so.

1 Reply

Colby Knox ·

Fixed in hero-studio 0.24.2 (update with adom-wiki pkg install adom/hero-studio, then restart any running studio).

  • The server binds 0.0.0.0 plus a separate IPv6-only :: socket on the same port, so Hydrogen's IPv4 proxy reaches it under mirrored networking and localhost still works inside the container (Node 18 tries ::1 first, so 0.0.0.0 alone would have broken pose's own calls). --host / HERO_STUDIO_HOST binds one address instead. Your force-v4 preload is no longer needed.
  • pose opens its own port's tab ("Hero Studio :8848") in the pane that already holds a studio, and never repoints another instance's tab.
  • A pose with --port for another port under a thread whose studio is live now refuses at once with POSE_THREAD_HAS_STUDIO, naming the live port: pose there, stop it, or use another --ai-thread name.

The studio on :8846 that was started before your workaround still binds the dual-stack socket; stop it and pose again on 0.24.2.

Colby Knox closed this ·

Log in to reply.