start.ps1 discovers the agent dir but never exports HERMES_WEBUI_AGENT_DIR, so native Windows startup dies on ModuleNotFoundError: yaml
Summary
start.ps1 discovers the hermes-agent directory correctly, prints it, and then never exports it to the child process. Because managed_agent_startup.activate_managed_agent() keys off the HERMES_WEBUI_AGENT_DIR env var only, dependency activation is skipped and the WebUI dies before it can reach the fallback discovery in api/config.py:
ModuleNotFoundError: No module named 'yaml' # then 'ruamel'This makes the documented native-Windows launch path (start.ps1) fail on a clean install, even though the agent dir is found and the managed environment that holds pyyaml/cryptography is present and healthy. bootstrap.py and ctl.sh refuse native Windows, so start.ps1 is the only supported launcher on this platform.
One-line fix at the bottom.
Environment
- hermes-webui:
8ac497df(clean clone, no local modifications) - hermes-agent:
~/.hermes/hermes-agent, PM-managed,pm.venv_is_current() == True - Managed runtime:
AppData/Local/hermes/tools/python-3.14.7-win32-x64 - PM environment:
AppData/Local/hermes/installs/<hash>/environments/<hash>/venv(containspyyaml 6.0.3,cryptography 50.0.2) - No
hermes-agent/venvpresent (PM-managed install, legacy venv absent) - OS: Windows 10 19045, native (no WSL), launched via
powershell -NoProfile -ExecutionPolicy Bypass -File ./start.ps1
Reproduce
- Native Windows host with a PM-managed hermes-agent at
%LOCALAPPDATA%\hermes\hermes-agentand nohermes-agent/venv. - Clean clone of hermes-webui. Do not set
HERMES_WEBUI_AGENT_DIR. powershell -NoProfile -ExecutionPolicy Bypass -File .\start.ps1
Observed:
[start.ps1] Hermes WebUI native Windows launcher
[start.ps1] Python: ...\hermes\tools\python-3.14.7...\python.exe
[start.ps1] Agent dir: C:\Users\<u>\AppData\Local\hermes\hermes-agent <-- found!
[start.ps1] State dir: C:\Users\<u>\AppData\Local\hermes\webui
[start.ps1] Binding: 127.0.0.1:8787
Traceback (most recent call last):
File "...\api\yaml_compat.py", line 25, in <module>
import yaml as _pyyaml
ModuleNotFoundError: No module named 'yaml'
During handling of the above exception, another exception occurred:
File "...\server.py", line 120, in <module>
from api.profiles import set_request_profile, clear_request_profile
File "...\api\profiles.py", line 22, in <module>
from api import yaml_compat as yaml
File "...\api\yaml_compat.py", line 28, in <module>
import ruamel.yaml
ModuleNotFoundError: No module named 'ruamel'Note the launcher prints the correct agent dir on line 3 and still fails.
Root cause
start.ps1 assigns discovery to a PowerShell variable and uses it only for local validation and display:
# start.ps1:99
$AgentDir = $env:HERMES_WEBUI_AGENT_DIR
# ... discovery into $AgentDir via $candidates ...
# start.ps1:180
Write-Host "[start.ps1] Agent dir: $AgentDir"
# start.ps1:205
& $Python $serverPath # <-- $AgentDir never reaches the child's environmentmanaged_agent_startup.activate_managed_agent() then returns immediately:
# managed_agent_startup.py:10-12
agent_dir = os.environ.get("HERMES_WEBUI_AGENT_DIR")
if not agent_dir:
return # <-- dependency activation silently skippedSo hermes_bootstrap is never imported, the PM environment is never put on sys.path, and the import ordering in server.py guarantees the crash:
# server.py:105-106 runs FIRST, no-ops because the env var is unset
from managed_agent_startup import activate_managed_agent
activate_managed_agent()
# server.py:112 api.config._discover_agent_dir() WOULD find it (6-candidate fallback)
from api.config import HOST, PORT, ...
# server.py:120 but this import needs yaml and crashes first
from api.profiles import set_request_profile, clear_request_profileThe fallback discovery in api/config.py:157 is effectively unreachable for dependency-activation purposes: it runs after the only hook that activates dependencies, and the crash happens 8 lines later. start.ps1 is therefore the sole remaining place that can supply the value in time — and it doesn't.
This is distinct from #1019 (discovery fails for non-standard paths; here discovery succeeds), #7848 (bootstrap.py probe import ordering on Linux), and #7843 (stale venv/bin/python on Linux). This issue is specifically start.ps1 not propagating a value it already computed.
Fix
Export the discovered value before launching the child, after the $AgentDir validation block (~line 131):
[Environment]::SetEnvironmentVariable('HERMES_WEBUI_AGENT_DIR', $AgentDir)activate_managed_agent() then imports hermes_bootstrap, the PM environment is activated, and the server starts normally. Verified on the environment above: startup proceeds to Hermes Web UI listening on http://127.0.0.1:8787, /health returns {"status":"ok", ...}.
start.sh is worth auditing for the same gap — if it relies on exported shell vars rather than export, POSIX hosts without a legacy agent venv would hit this too.
Workaround for other users
Add to .env in the repo root (no code change needed):
HERMES_WEBUI_AGENT_DIR=C:/Users/<user>/AppData/Local/hermes/hermes-agentDo not work around it with HERMES_WEBUI_PYTHON pointing at a hand-built venv: hermes_bootstrap relaunches into the managed store interpreter via hermes_cli.venv_sync.prepare_launch() (subprocess.call on Windows) and discards that choice, so the hand-built venv's packages are never used. The PM environment already provides pyyaml and cryptography; no extra venv is needed.
Source: nesquena/hermes-webui