Skip to content
Go back

When Hermes Stopped Answering on Discord

Edit page

When Hermes Stopped Answering on Discord

TL;DR

Sending /status to the bot produced “The application did not respond”. The gateway was being stopped every time the last SSH session closed: systemd-logind shuts down [email protected], and every unit inside it, once no session remains. Restart=always with RestartSec=5 then spent five dead seconds against Discord’s three-second interaction budget. loginctl enable-linger jeff keeps the user manager alive across logins, and /status has answered in 0.38 s since.

The setup being diagnosed here is the one described in Running a private Hermes Agent on a VPS. This note starts where that one stops.

Blueprint infographic: symptom, diagnosis, cause, fix, with the 5 s restart measured against the 3 s budget

The symptom

Sending /status to the Hermes bot in Discord returned:

“The application did not respond”

The command was visibly registered and the bot’s avatar was online, which is the misleading part: slash commands live in Discord’s registry, not in the running process, so they stay visible while the gateway is down. The connection was simply not there for the three seconds Discord waits.

The diagnostic trail

Step 1: the unit and the journal

Checked the service status and the user journal on the VPS:

systemctl --user status hermes-gateway.service
journalctl --user -u hermes-gateway -n 50 --no-pager

The service showed active (running) for only 7 s, and the systemd manager PID kept changing (112863 → 113122 → 113422 → 113650), with a matching Stopping → Shutdown context: signal=SIGTERM … parent_name=systemd → Stopped cycle each time:

Nov 11 23:34:32 systemd[112863]: Started hermes-gateway.service
Nov 11 23:35:02 systemd[112863]: Stopping hermes-gateway.service
Nov 11 23:35:05 systemd[112863]: Stopped hermes-gateway.service
Nov 11 23:37:50 systemd[113122]: Started hermes-gateway.service
Nov 11 23:38:17 systemd[113122]: Stopping hermes-gateway.service
Nov 11 23:38:20 systemd[113122]: Stopped hermes-gateway.service

A changing manager PID is the tell: every new number is a fresh [email protected], created by a login and destroyed on logout. The unit was never crashing into that churn; it was being carried down with the manager.

One of those cycles was different. At 23:37:52 the service died with Main process exited, code=killed, status=10/USR1, then Failed with result 'signal', and systemd scheduled a restart. USR1 is the signal the unit itself uses for reloads:

ExecReload=/bin/kill -USR1 $MAINPID

So of the restarts in that window, three were session teardown and one was a reload that killed the process instead of reloading it. That second failure is worth naming separately — it is an application-level bug, not a symptom of the session problem, and blaming everything on sessions would hide it.

The root cause is therefore the session lifecycle, not an application bug: without lingering, systemd-logind stops the user manager when the last session ends, and the unit dies with it. KillUserProcesses=false on this host does not save it, because that setting governs session scopes, and the gateway lives in the user manager’s cgroup, not in a session scope.

Step 2: Hermes’s own logs

Checked Hermes’s native log files inside ~/.hermes/logs/:

tail -n 60 ~/.hermes/logs/gateway.log

QuantaLatticeBot#5613 connected cleanly (✓ discord connected) and the slash-command set was already synced, so nothing on the Discord side was wrong. The connect sequence being clean does not by itself prove an external cause, but it rules out the obvious one: a bad token, a re-registration loop, or a crash during startup.

The logs are not traceback-free. The only tracebacks present were retried upstream errors — openai.RateLimitError: 429 from the model provider — plus SystemExit: 75 entries in gateway-exit-diag.log, which are planned restarts. None of them terminates the gateway; the stops came from outside the process.

Step 3: enabling lingering

Enabled persistent background execution for user jeff:

sudo loginctl enable-linger jeff

This created /var/lib/systemd/linger/jeff, which tells systemd-logind to start [email protected] at boot and keep it running when no session is active — 24/7, with no SSH connection required.

Two runs of that command are visible in the journal, at 23:43:17 and 23:44:44; the second is the one that stuck, matching the file’s mtime.

Step 4: live verification

Monitored the gateway and error logs in real time while invoking /status in Discord:

tail -f ~/.hermes/logs/gateway.log ~/.hermes/logs/errors.log
2026-11-11 23:45:28,754 INFO hermes_plugins.platforms__discord.adapter: [Discord] slash '/status' invoked by user=j3ffyang id=475063352813420566 channel=1568090466938003627 guild=None
2026-11-11 23:45:29,139 INFO gateway.platforms.base: [Discord] Sending response (411 chars) to 1568090466938003627

Hermes received /status and delivered a 411-character response in 0.385 seconds — comfortably inside Discord’s three-second window, with the timeout banner gone.

Why linger, and not a system unit

A dedicated system unit (/etc/systemd/system/hermes-gateway.service with User=jeff) is the more conventional answer for a server daemon, and it removes the session problem entirely. It also brings its own work: the unit moves to the system journal, its environment has to be spelled out without a user session, and it loses access to the user’s D-Bus session bus.

For a single-user VPS running one bot, linger is the smaller change. It leaves the unit file exactly where Hermes installed it, keeps systemctl --user as the management surface, and costs one command. The tradeoff is that the bot now runs whenever the machine is up, including while nobody is logged in, which is the point.

Telling a fault from a planned restart

The unit sets SuccessExitStatus=75 and RestartForceExitStatus=75, and Hermes exits 75 when it restarts itself on purpose. A restart counter that climbs is therefore not automatically a fault. On November 26 the gateway exited 75 twice within a minute, came back both times, and has been up since 04:07 that morning.

A real fault looks different: Failed with result 'signal', an exit status other than 75 or 78, or the unit vanishing because the user manager stopped. Check systemctl --user show -p MainPID across logins — if the number changes, the session teardown is back.

What this did not fix

The gateway still logs 429 rate-limit errors from the upstream model provider when a free model is at capacity. Those are retried and are unrelated to the Discord timeout. They are worth watching, because while the retries run, a slash command that needs the model will be slow — but it will not be turned away by Discord, since the acknowledgement is separate from the answer.

Maintenance commands

What was verified, and what was not

btw, i use arch


Edit page
Share this post on:

Previous Post
北静王水溶
Next Post
A Skill or an MCP Server? Two Ways to Give an Agent a Trick