hermes - ✅(Solved) Fix [Bug]: WhatsApp bridge script (bridge.js) missing in NixOS module installation [1 pull requests, 1 participants]

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…
GitHub stats
NousResearch/hermes-agent#15336Fetched 2026-04-25 06:22:54
View on GitHub
Comments
0
Participants
1
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
labeled ×5cross-referenced ×1referenced ×1

Error Message

  1. Observe the error output in the logs. The bridge fails to start with the following error:

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

PR fix notes

PR #15460: fix(whatsapp): bundle bridge.js with the gateway package so pip/Nix installs find it (#15336)

Description (problem / solution / changelog)

What does this PR do?

Fixes `#15336`. The WhatsApp bridge (Node.js daemon launched by `WhatsAppAdapter`) lived at `scripts/whatsapp-bridge/` — outside any Python package. Setuptools' `find_packages` only ships files that live INSIDE a package directory, so `pip install` (and downstream Nix / Docker / Homebrew installs that build from the wheel) silently dropped the bridge from the artifact. When users on those install paths tried to start the WhatsApp gateway:

``` ✗ Bridge script not found at /nix/store/.../site-packages/scripts/whatsapp-bridge/bridge.js ```

Even though the source tree had `scripts/whatsapp-bridge/bridge.js`, the installed wheel did not.

Fix

Move the bridge inside the `gateway` package — its only consumer — and register it as setuptools package-data so wheels actually contain it. The directory now lives at `gateway/whatsapp_bridge/` and resolves cleanly under both source-tree runs and installed wheels.

Changes

  • `git mv scripts/whatsapp-bridge/ → gateway/whatsapp_bridge/` (5 files: `bridge.js`, `allowlist.js`, `allowlist.test.mjs`, `package.json`, `package-lock.json`)
  • New `gateway/whatsapp_bridge/init.py` marker — required so `find_packages` treats it as a regular setuptools package and the package-data globs reliably include the JS files (PEP 420 namespace packages have spotty package-data support across setuptools versions)
  • `pyproject.toml`: new `[tool.setuptools.package-data]` entry: ```toml "gateway.whatsapp_bridge" = [".js", ".mjs", "package.json", "package-lock.json"] ``` Globs deliberately exclude `node_modules` — the `hermes setup` flow re-creates that tree at runtime via `npm install`, so we don't bloat the wheel with a resolved dependency tree.
  • Update three resolvers:
    • `gateway/platforms/whatsapp.py::WhatsAppAdapter._DEFAULT_BRIDGE_DIR` → `Path(file).parents[1] / "whatsapp_bridge"`
    • `hermes_cli/main.py`: bridge-deps install step now resolves via `gateway.file` so it works under wheel installs too
    • `hermes_cli/doctor.py`: same — npm-audit step also uses the package-relative path
  • Doc updates in `CONTRIBUTING.md` and `website/docs/user-guide/docker.md` to point at the new path

Related Issue

Fixes #15336

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (file move; no behavior change beyond the bug fix)

Test plan

  • 5 new tests in `tests/gateway/test_whatsapp_bridge_packaging.py` — all green on py3.11 venv
  • All 43 pre-existing whatsapp tests still pass (`test_whatsapp_connect.py` + `test_whatsapp_formatting.py`) — 48 total green
  • Verified regression guards: temporarily removed the `gateway.whatsapp_bridge` package-data entry from `pyproject.toml`; `test_pyproject_package_data_covers_bridge_files` correctly failed with the exact assertion message ("wheel installs will not contain bridge.js (#15336)"). Restored → all 5 pass.

Test coverage detail

`test_whatsapp_bridge_packaging.py` (5 tests):

  • `test_bridge_dir_resolves_from_gateway_package` — `_DEFAULT_BRIDGE_DIR` computes to a real existing directory
  • `test_bridge_dir_lives_inside_gateway_package` — pin the location so a future move doesn't silently desync from `pyproject.toml`
  • `test_bridge_dir_contains_required_files` — `bridge.js`, `allowlist.js`, `package.json` all present
  • `test_pyproject_package_data_covers_bridge_files` — parses `pyproject.toml` via `tomllib` so this regression is caught even outside an installed wheel; pins both `*.js` and `package.json` patterns
  • `test_bridge_init_marker_present` — the `init.py` marker exists (the thing that makes the directory a real setuptools package on every version)

Why move to `gateway/whatsapp_bridge/` and not just include `scripts/`?

Considered but rejected:

  1. Add `scripts/init.py` — would also pull every other dev script (`build_skills_index.py`, `contributor_audit.py`, `release.py`, etc.) into the importable Python namespace. Bigger surface, fragile.
  2. `[tool.setuptools.data-files]` — places files under `<prefix>/` not `site-packages/`, doesn't match the resolver path or fix the `pip install` case.
  3. PEP 420 namespace packages with `scripts.*` — works on modern setuptools but breaks on older versions still in use across the install matrix (Nix pins setuptools per channel, Homebrew lags).

Moving inside `gateway/` is the smallest surface area that works on every setuptools version, keeps the bridge next to its only consumer, and matches the existing `hermes_cli = ["web_dist/**/*"]` pattern already in the codebase.

Out of scope

  • Symlinking back to `scripts/whatsapp-bridge/` for backward compat with operator scripts that might `cd scripts/whatsapp-bridge && npm install` directly. The `hermes setup` flow now does that via the new path; a follow-up could add an alias.
  • The Dockerfile reference (already mentions the bridge but uses `pip install -e .` so it picks up the source-tree path automatically). Verified the Dockerfile builds unchanged.

Changed files

  • CONTRIBUTING.md (modified, +3/-3)
  • gateway/platforms/whatsapp.py (modified, +119/-7)
  • gateway/whatsapp_bridge/__init__.py (added, +22/-0)
  • gateway/whatsapp_bridge/allowlist.js (renamed, +0/-0)
  • gateway/whatsapp_bridge/allowlist.test.mjs (renamed, +0/-0)
  • gateway/whatsapp_bridge/bridge.js (renamed, +0/-0)
  • gateway/whatsapp_bridge/package-lock.json (renamed, +0/-0)
  • gateway/whatsapp_bridge/package.json (renamed, +0/-0)
  • hermes_cli/doctor.py (modified, +18/-2)
  • hermes_cli/main.py (modified, +14/-2)
  • pyproject.toml (modified, +7/-0)
  • tests/gateway/test_whatsapp_bridge_packaging.py (added, +292/-0)
  • tests/gateway/test_whatsapp_connect.py (modified, +5/-0)
  • tests/gateway/test_whatsapp_formatting.py (modified, +5/-0)
  • website/docs/user-guide/docker.md (modified, +1/-1)

Code Example

services.hermes-agent = {
  enable = true;
  environment = {
    WHATSAPP_ENABLED = "true";
    WHATSAPP_MODE = "bot";
    WHATSAPP_ALLOWED_USERS = "<redacted>";
  };
  addToSystemPackages = true;
};

---

Bridge script not found at /nix/store/lixvwbz613sagzjyfyb9fv7xrd39780p-hermes-agent-0.10.0/lib/python3.12/site-packages/scripts/whatsapp-bridge/bridge.js

---

--- hermes dump ---                                                      
version:          0.10.0 (2026.4.16) [(unknown)]
os:               Linux 6.12.80 x86_64                                   
python:           3.12.13                                                
openai_sdk:       2.24.0                                                 
profile:          default                                                
hermes_home:      ~/.hermes                                              
model:            gemma4:e4b                                             
provider:         ollama                                           
terminal:         local                                                  

api_keys:                                                                
  openrouter           not set                                           
  openai               not set                                           
  anthropic            not set                                           
  anthropic_token      not set                                           
  nous                 not set                                           
  glm/zai              not set                                           
  zai                  not set                                           
  kimi                 not set                                           
  minimax              not set                                           
  deepseek             not set                                           
  dashscope            not set                                           
  huggingface          not set                                           
  nvidia               not set                                           
  ai_gateway           not set                                           
  opencode_zen         not set                                           
  opencode_go          not set                                           
  kilocode             not set                                           
  firecrawl            not set                                           
  tavily               not set                                           
  browserbase          not set                                           
  fal                  not set                                           
  elevenlabs           not set                                           
  github               not set                                           

features:                                                                
  toolsets:           hermes-cli                                         
  mcp_servers:        0                                                  
  memory_provider:    built-in                                           
  gateway:            running (systemd (user), pid 39203)
  platforms:          whatsapp                                           
  cron_jobs:          0                                                  
  skills:             72                                                 
--- end dump ---                                      

--- agent.log ---
2026-04-24 16:47:11,710 INFO gateway.run: Starting Hermes Gateway...
2026-04-24 16:47:11,711 INFO gateway.run: Session storage: /var/lib/hermes/.hermes/sessions
2026-04-24 16:47:11,876 INFO gateway.run: Connecting to whatsapp...
2026-04-24 16:47:11,907 WARNING gateway.platforms.whatsapp: [Whatsapp] Bridge script not found: /nix/store/lixvwbz613sagzjyfyb9fv7xrd39780p-hermes-agent-0.10.0/lib/python3.12/site-packages/scripts/whatsapp-bridge/bridge.js
2026-04-24 16:47:11,907 WARNING gateway.run: ✗ whatsapp failed to connect

---

$ ls -la /nix/store/lixvwbz613sagzjyfyb9fv7xrd39780p-hermes-agent-0.10.0/lib/python3.12/site-packages/
total 1464
dr-xr-xr-x 12 root root   4096 Jan  1  1970 .
dr-xr-xr-x  3 root root   4096 Jan  1  1970 ..
dr-xr-xr-x  3 root root   4096 Jan  1  1970 acp_adapter
dr-xr-xr-x  4 root root   4096 Jan  1  1970 agent
-r--r--r--  4 root root  55631 Jan  1  1970 batch_runner.py
-r--r--r--  2 root root 496517 Jan  1  1970 cli.py
dr-xr-xr-x  3 root root   4096 Jan  1  1970 cron
dr-xr-xr-x  5 root root   4096 Jan  1  1970 gateway
dr-xr-xr-x  3 root root   4096 Jan  1  1970 hermes_agent-0.10.0.dist-info
dr-xr-xr-x  3 root root   4096 Jan  1  1970 hermes_cli
-r--r--r--  6 root root  10400 Jan  1  1970 hermes_constants.py
-r--r--r--  7 root root  13620 Jan  1  1970 hermes_logging.py
-r--r--r--  3 root root  65585 Jan  1  1970 hermes_state.py
-r--r--r--  7 root root   3209 Jan  1  1970 hermes_time.py
-r--r--r--  3 root root  25370 Jan  1  1970 model_tools.py
dr-xr-xr-x  8 root root   4096 Jan  1  1970 plugins
dr-xr-xr-x  2 root root   4096 Jan  1  1970 __pycache__
-r--r--r--  7 root root  16286 Jan  1  1970 rl_cli.py
-r--r--r--  2 root root 624276 Jan  1  1970 run_agent.py
dr-xr-xr-x  5 root root   4096 Jan  1  1970 tools
-r--r--r--  7 root root  12332 Jan  1  1970 toolset_distributions.py
-r--r--r--  6 root root  23247 Jan  1  1970 toolsets.py
-r--r--r--  4 root root  65305 Jan  1  1970 trajectory_compressor.py
dr-xr-xr-x  3 root root   4096 Jan  1  1970 tui_gateway
-r--r--r--  4 root root   9301 Jan  1  1970 utils.py
RAW_BUFFERClick to expand / collapse

Bug Description

When running Hermes on NixOS via the native systemd module, attempting to use the WhatsApp bridge functionality fails. The application is looking for bridge.js inside the Python site-packages directory within the Nix store, but the script is not present in the packaged artifact.

Steps to Reproduce

  1. Install and configure Hermes on NixOS using the native NixOS module as described in the docs.
  2. Start the Hermes systemd service.
  3. Attempt to initialize/use the WhatsApp bridge functionality.
  4. Observe the error output in the logs.

Minimal config to reproduce:

services.hermes-agent = {
  enable = true;
  environment = {
    WHATSAPP_ENABLED = "true";
    WHATSAPP_MODE = "bot";
    WHATSAPP_ALLOWED_USERS = "<redacted>";
  };
  addToSystemPackages = true;
};

Expected Behavior

The WhatsApp bridge should successfully locate bridge.js, launch the node process, and connect.

Actual Behavior

The bridge fails to start with the following error:

✗ Bridge script not found at /nix/store/lixvwbz613sagzjyfyb9fv7xrd39780p-hermes-agent-0.10.0/lib/python3.12/site-packages/scripts/whatsapp-bridge/bridge.js

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

WhatsApp

Debug Report

--- hermes dump ---                                                      
version:          0.10.0 (2026.4.16) [(unknown)]
os:               Linux 6.12.80 x86_64                                   
python:           3.12.13                                                
openai_sdk:       2.24.0                                                 
profile:          default                                                
hermes_home:      ~/.hermes                                              
model:            gemma4:e4b                                             
provider:         ollama                                           
terminal:         local                                                  

api_keys:                                                                
  openrouter           not set                                           
  openai               not set                                           
  anthropic            not set                                           
  anthropic_token      not set                                           
  nous                 not set                                           
  glm/zai              not set                                           
  zai                  not set                                           
  kimi                 not set                                           
  minimax              not set                                           
  deepseek             not set                                           
  dashscope            not set                                           
  huggingface          not set                                           
  nvidia               not set                                           
  ai_gateway           not set                                           
  opencode_zen         not set                                           
  opencode_go          not set                                           
  kilocode             not set                                           
  firecrawl            not set                                           
  tavily               not set                                           
  browserbase          not set                                           
  fal                  not set                                           
  elevenlabs           not set                                           
  github               not set                                           

features:                                                                
  toolsets:           hermes-cli                                         
  mcp_servers:        0                                                  
  memory_provider:    built-in                                           
  gateway:            running (systemd (user), pid 39203)
  platforms:          whatsapp                                           
  cron_jobs:          0                                                  
  skills:             72                                                 
--- end dump ---                                      

--- agent.log ---
2026-04-24 16:47:11,710 INFO gateway.run: Starting Hermes Gateway...
2026-04-24 16:47:11,711 INFO gateway.run: Session storage: /var/lib/hermes/.hermes/sessions
2026-04-24 16:47:11,876 INFO gateway.run: Connecting to whatsapp...
2026-04-24 16:47:11,907 WARNING gateway.platforms.whatsapp: [Whatsapp] Bridge script not found: /nix/store/lixvwbz613sagzjyfyb9fv7xrd39780p-hermes-agent-0.10.0/lib/python3.12/site-packages/scripts/whatsapp-bridge/bridge.js
2026-04-24 16:47:11,907 WARNING gateway.run: ✗ whatsapp failed to connect

Operating System

NixOS 25.11

Python Version

3.12.13

Hermes Version

Hermes Agent v0.10.0 (2026.4.16)

Additional Logs / Traceback (optional)

$ ls -la /nix/store/lixvwbz613sagzjyfyb9fv7xrd39780p-hermes-agent-0.10.0/lib/python3.12/site-packages/
total 1464
dr-xr-xr-x 12 root root   4096 Jan  1  1970 .
dr-xr-xr-x  3 root root   4096 Jan  1  1970 ..
dr-xr-xr-x  3 root root   4096 Jan  1  1970 acp_adapter
dr-xr-xr-x  4 root root   4096 Jan  1  1970 agent
-r--r--r--  4 root root  55631 Jan  1  1970 batch_runner.py
-r--r--r--  2 root root 496517 Jan  1  1970 cli.py
dr-xr-xr-x  3 root root   4096 Jan  1  1970 cron
dr-xr-xr-x  5 root root   4096 Jan  1  1970 gateway
dr-xr-xr-x  3 root root   4096 Jan  1  1970 hermes_agent-0.10.0.dist-info
dr-xr-xr-x  3 root root   4096 Jan  1  1970 hermes_cli
-r--r--r--  6 root root  10400 Jan  1  1970 hermes_constants.py
-r--r--r--  7 root root  13620 Jan  1  1970 hermes_logging.py
-r--r--r--  3 root root  65585 Jan  1  1970 hermes_state.py
-r--r--r--  7 root root   3209 Jan  1  1970 hermes_time.py
-r--r--r--  3 root root  25370 Jan  1  1970 model_tools.py
dr-xr-xr-x  8 root root   4096 Jan  1  1970 plugins
dr-xr-xr-x  2 root root   4096 Jan  1  1970 __pycache__
-r--r--r--  7 root root  16286 Jan  1  1970 rl_cli.py
-r--r--r--  2 root root 624276 Jan  1  1970 run_agent.py
dr-xr-xr-x  5 root root   4096 Jan  1  1970 tools
-r--r--r--  7 root root  12332 Jan  1  1970 toolset_distributions.py
-r--r--r--  6 root root  23247 Jan  1  1970 toolsets.py
-r--r--r--  4 root root  65305 Jan  1  1970 trajectory_compressor.py
dr-xr-xr-x  3 root root   4096 Jan  1  1970 tui_gateway
-r--r--r--  4 root root   9301 Jan  1  1970 utils.py

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 WhatsApp bridge functionality in Hermes on NixOS fails due to the missing bridge.js script in the Python site-packages directory, suggesting a packaging or installation issue.

Guidance

  1. Verify the package contents: Check the Nix package definition for Hermes to ensure that bridge.js is included in the package and correctly installed in the site-packages directory.
  2. Inspect the site-packages directory: Use the provided ls command to verify the contents of the site-packages directory and confirm that bridge.js is missing.
  3. Review the Hermes configuration: Ensure that the Hermes configuration is correct, and the WhatsApp bridge is properly enabled and configured.
  4. Check for dependencies: Verify that all required dependencies for the WhatsApp bridge are installed and up-to-date.

Example

No code example is provided as the issue seems to be related to packaging or installation rather than code.

Notes

The root cause of the issue appears to be related to the packaging or installation of the Hermes agent on NixOS, rather than a code issue. Further investigation into the Nix package definition and installation process may be necessary to resolve the issue.

Recommendation

Apply a workaround by manually installing or copying the missing bridge.js script to the correct location, if possible, while investigating the packaging or installation 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

hermes - ✅(Solved) Fix [Bug]: WhatsApp bridge script (bridge.js) missing in NixOS module installation [1 pull requests, 1 participants]