hermes - 💡(How to fix) Fix [Bug] WhatsApp adapter fails to load due to scope bug in check_whatsapp_requirements() [2 comments, 2 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#15585Fetched 2026-04-26 05:26:25
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2closed ×1

Error Message

The WhatsApp gateway adapter fails to load with the error:

Root Cause

The bug is in gateway/platforms/whatsapp.py. The standalone function check_whatsapp_requirements() (module-level, line 115) references _DEFAULT_BRIDGE_DIR which is defined as a class variable inside WhatsAppAdapter (line 182).

This causes a NameError during the function execution, making check_whatsapp_requirements() return False, which leads the gateway to believe the WhatsApp adapter is not properly configured.

Fix Action

Workaround

Revert gateway/platforms/whatsapp.py to commit f23123e7 (April 19, 2026, pre-refactor) or move _DEFAULT_BRIDGE_DIR definition to module-level before check_whatsapp_requirements().

Code Example

WARNING gateway.run: WhatsApp: Node.js not installed or bridge not configured
WARNING gateway.run: No adapter available for whatsapp
RAW_BUFFERClick to expand / collapse

Bug Description

The WhatsApp gateway adapter fails to load with the error:

WARNING gateway.run: WhatsApp: Node.js not installed or bridge not configured
WARNING gateway.run: No adapter available for whatsapp

Root Cause

The bug is in gateway/platforms/whatsapp.py. The standalone function check_whatsapp_requirements() (module-level, line 115) references _DEFAULT_BRIDGE_DIR which is defined as a class variable inside WhatsAppAdapter (line 182).

This causes a NameError during the function execution, making check_whatsapp_requirements() return False, which leads the gateway to believe the WhatsApp adapter is not properly configured.

Technical Details

File: gateway/platforms/whatsapp.py

Problem locations:

  • Line 115: def check_whatsapp_requirements() -> bool: (module-level function)
  • Line 137: bridge_script = str(_DEFAULT_BRIDGE_DIR / "bridge.js") (references undefined variable)
  • Line 182: _DEFAULT_BRIDGE_DIR = Path(...) (class variable, not module-level)

Introduced in commit: 28b3f49a ("refactor: remove remaining redundant local imports") on April 21, 2026

Environment

  • Hermes Agent version: v2026.4.23 and current main branch
  • Node.js: Installed and working (v22.22.2)
  • Bridge script: Present at scripts/whatsapp-bridge/bridge.js

Workaround

Revert gateway/platforms/whatsapp.py to commit f23123e7 (April 19, 2026, pre-refactor) or move _DEFAULT_BRIDGE_DIR definition to module-level before check_whatsapp_requirements().

Checklist

  • I have searched existing issues and this bug has not been reported
  • I have confirmed this bug exists in the current main branch
  • I have identified the specific commit that introduced the regression

extent analysis

TL;DR

Move the _DEFAULT_BRIDGE_DIR definition to module-level in gateway/platforms/whatsapp.py to fix the WhatsApp gateway adapter loading issue.

Guidance

  • Verify that _DEFAULT_BRIDGE_DIR is defined before the check_whatsapp_requirements() function by checking the order of definitions in whatsapp.py.
  • Consider reverting gateway/platforms/whatsapp.py to commit f23123e7 as a temporary workaround if moving the definition is not feasible.
  • Ensure Node.js and the bridge script are properly installed and configured, as the error message suggests, even though the issue is caused by a different factor.
  • Review the commit history to understand how the refactor in commit 28b3f49a introduced this regression.

Example

# Before (incorrect)
def check_whatsapp_requirements() -> bool:
    # ...

_DEFAULT_BRIDGE_DIR = Path(...)

# After (corrected)
_DEFAULT_BRIDGE_DIR = Path(...)
def check_whatsapp_requirements() -> bool:
    # ...

Notes

This fix assumes that moving the _DEFAULT_BRIDGE_DIR definition to module-level does not introduce other issues. It's essential to test the corrected code thoroughly.

Recommendation

Apply workaround: Move the _DEFAULT_BRIDGE_DIR definition to module-level, as this directly addresses the identified root cause without requiring a version upgrade or more invasive changes.

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