hermes - 💡(How to fix) Fix [Bug]: Discord presence fails due to missing get_config in gateway.config

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…

Error Message

except Exception: except Exception:

Root Cause

Bug Description: On gateway startup, the Discord adapter fails to set the bot’s presence (online status) because it imports a non-existent function get_config from gateway.config.

RAW_BUFFERClick to expand / collapse

Thanks for reporting a bug! This issue was opened by Hermes Agent (Iris) on behalf of user nmorgowicz.

Bug Description: On gateway startup, the Discord adapter fails to set the bot’s presence (online status) because it imports a non-existent function get_config from gateway.config.

This causes:

  • The bot to connect as Iris#5744.
  • But its presence (online/idle/etc.) is never set.
  • Users see the bot as offline even though the gateway is running and functional.

The failure is logged as:

  • "[Discord] Failed to set presence: cannot import name 'get_config' from 'gateway.config"

Steps to Reproduce:

  1. Use Hermes Agent with Discord integration configured (discord.status: online in config.yaml).
  2. Start or restart the gateway:
    • systemctl --user restart hermes-gateway
  3. Observe gateway logs:
    • journalctl --user -u hermes-gateway -f
    • or ~/.hermes/logs/gateway.log
  4. On startup, you will see:
    • "[Discord] Connected as Iris#5744"
    • "[Discord] Failed to set presence: cannot import name 'get_config' from 'gateway.config"
  5. In Discord:
    • The bot appears offline even though the gateway is active and responding to messages.

Expected Behavior:

  • The Discord bot should set its presence according to config.yaml (e.g., status: online) and appear online.
  • No import errors related to gateway.config during presence setup.

Actual Behavior:

  • The presence-setting code in gateway/platforms/discord.py attempts:
    • from gateway.config import get_config
    • cfg = get_config()
  • But get_config does not exist in gateway/config.py, so:
    • ImportError is raised.
    • Presence is never set.
    • Bot shows as offline.

Affected Component:

  • Gateway (Telegram/Discord/Slack/WhatsApp)
  • Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related):

  • Discord

Debug Report: This was observed on a real deployment. If needed, I can run hermes debug share and attach the links.

Operating System:

  • Ubuntu 26.04 LTS (Linux 7.0.0-15-generic x86_64)

Python Version:

  • 3.11.15

Hermes Version:

  • Hermes Agent v0.14.0 (2026.5.16)

Root Cause Analysis: The root cause is in:

  • gateway/platforms/discord.py (on_ready handler):
    • It imports: from gateway.config import get_config
    • Then uses: cfg = get_config() to read discord.status and discord.activity.
  • However, gateway/config.py does not export get_config.
  • This is a missing function that should either:
    • Be implemented as a helper to load the raw config dict, or
    • Be replaced with an existing config loader.

Proposed Fix: Option 1 (minimal, local to Hermes):

  • Add a simple get_config() function in gateway/config.py that:
    • Loads ~/.hermes/config.yaml
    • Optionally merges ~/.hermes/gateway.json
    • Returns a plain dict
  • This matches what discord.py expects (cfg.get("discord", {})).

Example implementation:

def get_config() -> dict: """ Load raw gateway/user configuration as a plain dict.

Used by platform adapters (e.g. Discord presence) to read
high-level config.yaml values without going through GatewayConfig.

Merges:
  - ~/.hermes/gateway.json (if present) as base
  - ~/.hermes/config.yaml (if present) on top
"""
_home = get_hermes_home()
cfg: dict = {}

gateway_json_path = _home / "gateway.json"
if gateway_json_path.exists():
    try:
        with open(gateway_json_path, "r", encoding="utf-8") as f:
            gw_data = json.load(f) or {}
        if isinstance(gw_data, dict):
            cfg.update(gw_data)
    except Exception:
        pass

try:
    import yaml as _yaml
    config_yaml_path = _home / "config.yaml"
    if config_yaml_path.exists():
        with open(config_yaml_path, encoding="utf-8") as f:
            yaml_cfg = _yaml.safe_load(f) or {}
        if isinstance(yaml_cfg, dict):
            cfg.update(yaml_cfg)
except Exception:
    pass

return cfg

Option 2 (if you prefer not to add get_config):

  • Update gateway/platforms/discord.py to:
    • Use an existing config-loading function, or
    • Load config.yaml directly in a localized way.

I'd like to fix this myself and submit a PR:

  • Yes, I can submit a PR with the above fix if helpful.

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 - 💡(How to fix) Fix [Bug]: Discord presence fails due to missing get_config in gateway.config