hermes - ✅(Solved) Fix Discord gateway connect timeout is too short when slash command sync takes >30s [1 pull requests, 1 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#19776Fetched 2026-05-05 06:05:15
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Hermes gateway can fail to start on Discord because the platform connect timeout is fixed/defaulted to 30 seconds. In my setup, Discord slash command registration/sync takes around 28-31 seconds. Hermes kills the connect attempt at 30s, even though Discord is still making progress, then launchd restarts the service. This can leave the gateway in a restart loop and make Hermes stop replying on Discord.

Error Message

Connecting to discord... [Discord] Registered /skill command with 173 skill(s) via autocomplete ✗ discord error: discord connect timed out after 30s [Discord] Disconnected Gateway failed to connect any configured messaging platform: discord: discord connect timed out after 30s

Root Cause

Hermes gateway can fail to start on Discord because the platform connect timeout is fixed/defaulted to 30 seconds. In my setup, Discord slash command registration/sync takes around 28-31 seconds. Hermes kills the connect attempt at 30s, even though Discord is still making progress, then launchd restarts the service. This can leave the gateway in a restart loop and make Hermes stop replying on Discord.

Fix Action

Workaround

Setting this env var fixed the immediate issue:

HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT=90

After restarting the launchd service with that env var, Discord connected successfully:

[Discord] Connected as Hermes#0401
✓ discord connected
Gateway running with 1 platform(s)

PR fix notes

PR #19808: fix(gateway): raise default Discord connect timeout to 90s

Description (problem / solution / changelog)

Raise the default platform connect timeout for Discord from 30s to 90s so launchd-managed Discord gateways with many slash commands no longer fail at startup.

What changed and why

  • _platform_connect_timeout_secs() in gateway/run.py now takes the target platform and returns a per-platform default. Discord defaults to 90s, every other platform keeps the existing 30s default.
  • HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT still overrides every platform when set, so the documented escape hatch is unchanged.
  • Updated website/docs/reference/environment-variables.md to mention the Discord-specific default.
  • Reason: Discord registers slash commands during connect(). With many skills the local registration + login + WS handshake + on_ready can legitimately exceed the old 30s outer timeout, killing the connect even though Discord is making progress and would have come up shortly after. Reporters confirmed HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT=90 resolves the failure.

How to test

  • pytest tests/gateway/test_platform_reconnect.py -q — includes a new regression test that asserts Discord's default is higher than the global default and that the env var still overrides both.
  • Manual: on a Discord-only gateway with many skills, restart the gateway without HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT set and confirm it connects (no "discord connect timed out after 30s" error).

What platforms tested on

  • macOS on darwin-arm64 (local)

Fixes #19776

<!-- autocontrib:worker-id=issue-new-8d7c75a7 kind=pr-open -->

Changed files

  • gateway/run.py (modified, +22/-3)
  • tests/gateway/test_platform_reconnect.py (modified, +18/-0)
  • website/docs/reference/environment-variables.md (modified, +1/-1)

Code Example

Connecting to discord...
[Discord] Registered /skill command with 173 skill(s) via autocomplete
✗ discord error: discord connect timed out after 30s
[Discord] Disconnected
Gateway failed to connect any configured messaging platform: discord: discord connect timed out after 30s

---

[Discord] Registered /skill command with 173 skill(s) via autocomplete
[Discord] Connected as Hermes#0401
✓ discord connected
Gateway running with 1 platform(s)

---

Hermes installed via ~/.hermes/hermes-agent
Gateway managed by launchd on macOS
Platform: Discord
Configured slash commands: 173 skills

---

2026-05-04 15:11:41 Connecting to discord...
2026-05-04 15:12:09 [Discord] Registered /skill command with 173 skill(s) via autocomplete
2026-05-04 15:12:11 ✗ discord error: discord connect timed out after 30s

---

HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT=90

---

[Discord] Connected as Hermes#0401
✓ discord connected
Gateway running with 1 platform(s)

---

gateway:
  platform_connect_timeout: 90
RAW_BUFFERClick to expand / collapse

Summary

Hermes gateway can fail to start on Discord because the platform connect timeout is fixed/defaulted to 30 seconds. In my setup, Discord slash command registration/sync takes around 28-31 seconds. Hermes kills the connect attempt at 30s, even though Discord is still making progress, then launchd restarts the service. This can leave the gateway in a restart loop and make Hermes stop replying on Discord.

Observed behaviour

Gateway logs repeatedly show:

Connecting to discord...
[Discord] Registered /skill command with 173 skill(s) via autocomplete
✗ discord error: discord connect timed out after 30s
[Discord] Disconnected
Gateway failed to connect any configured messaging platform: discord: discord connect timed out after 30s

On one run, the gateway did connect successfully just after the old timeout window:

[Discord] Registered /skill command with 173 skill(s) via autocomplete
[Discord] Connected as Hermes#0401
✓ discord connected
Gateway running with 1 platform(s)

But because restarts were already in progress, that process was then terminated and launchd continued cycling.

Expected behaviour

If the Discord client is actively progressing, for example slash commands were registered/synced, the gateway should not be killed at exactly 30 seconds. Either:

  1. the default platform connect timeout should be longer for Discord;
  2. the timeout should be configurable in documented config, not only via env var;
  3. slash command sync should happen after the bot is considered connected; or
  4. progress during connect should refresh/extend the startup watchdog.

Reproduction notes

Environment:

Hermes installed via ~/.hermes/hermes-agent
Gateway managed by launchd on macOS
Platform: Discord
Configured slash commands: 173 skills

Failure pattern:

2026-05-04 15:11:41 Connecting to discord...
2026-05-04 15:12:09 [Discord] Registered /skill command with 173 skill(s) via autocomplete
2026-05-04 15:12:11 ✗ discord error: discord connect timed out after 30s

The key point is that Discord command registration completed at about 28s, then the whole connect attempt was killed at 30s.

Workaround

Setting this env var fixed the immediate issue:

HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT=90

After restarting the launchd service with that env var, Discord connected successfully:

[Discord] Connected as Hermes#0401
✓ discord connected
Gateway running with 1 platform(s)

Suggested fix

Make the platform connect timeout longer by default for Discord, or move Discord slash command sync outside the critical connect timeout. A 30s hard/default timeout seems too tight for accounts with many skills/slash commands or slow Discord API responses.

It would also help to document HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT, or expose it as something like:

gateway:
  platform_connect_timeout: 90

The current failure mode is confusing because launchd keeps the service running, but Hermes is not actually connected long enough to respond.

extent analysis

TL;DR

Increase the platform connect timeout to a value greater than 30 seconds to prevent Hermes gateway from failing to start on Discord.

Guidance

  • Verify the current platform connect timeout value, which is defaulted to 30 seconds, and consider increasing it to accommodate the time it takes for Discord slash command registration/sync.
  • Set the HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT environment variable to a higher value, such as 90 seconds, to temporarily workaround the issue.
  • Consider configuring the timeout value in a documented configuration file, such as a YAML file, for easier management and flexibility.
  • Review the Discord API response times and the number of skills/slash commands to determine an optimal timeout value.

Example

Setting the HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT environment variable to 90 seconds can be done as follows:

HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT=90

Alternatively, configuring the timeout value in a YAML file could look like this:

gateway:
  platform_connect_timeout: 90

Notes

The ideal timeout value may vary depending on the specific setup and Discord API response times. It's essential to find a balance between allowing enough time for connection and preventing indefinite waits.

Recommendation

Apply the workaround by setting the HERMES_GATEWAY_PLATFORM_CONNECT_TIMEOUT environment variable to a higher value, such as 90 seconds, to prevent the Hermes gateway from failing to start on Discord. This will provide a temporary solution until a more permanent fix can be implemented.

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 Discord gateway connect timeout is too short when slash command sync takes >30s [1 pull requests, 1 comments, 2 participants]