#Repeat HEARTBEAT messages. Issue found with constant gateway restarts

1 messages Β· Page 1 of 1 (latest)

royal abyss
#

Noticed a few people have mentioned constant heartbeat messages and I've seen the same in Telegram.

After digging into it the heartbeat config file, mine is empty.

Further digging uncovered this:


Root cause: Multiple gateway restarts are resetting the heartbeat timer. Each "[heartbeat] started" in the log = one restart.```

```The gateway is restarting because:

1. update.run is being called β€” this always triggers a restart after updates
2. config.apply is failing with "invalid config" but still triggering a reload
3. Config change detection is picking up modifications
What's sending these?```

I've not been making frequent overnight config changes either.
frail sedgeBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

misty sageBOT
# royal abyss Noticed a few people have mentioned constant heartbeat messages and I've seen th...

This is a common issue with a few possible culprits. Here's what to check:

Most Likely Causes

1. Automatic update checks
The gateway has a built-in update checker. If updates are downloading automatically (especially overnight), each update triggers a restart. Check:

clawdbot gateway call config.get --path gateway

Look for update.* settings.

2. Cron jobs running update/config commands
Check your crons:

clawdbot cron list

If any cron is calling update.run or config.apply, that's your culprit.

#

3. External scripts or monitoring
Do you have any scripts (npm scripts, systemd timers, CI pipelines) that call:

  • clawdbot update run
  • clawdbot gateway call config.apply
  • clawdbot gateway call update.run

4. File watcher false positives
Some editors/IDEs save files in ways that trigger config change detection. If gateway.reload.mode is set to watch files, this can cause spurious reloads.

Quick Diagnostic

Check recent gateway restarts:

clawdbot gateway call config.get --path gateway

Look for:

  • update.check - how often it checks for updates
#
  • update.auto - whether auto-download is enabled
  • reload.mode - hot vs restart-required

Immediate Fix

If you suspect auto-updates, disable them:

clawdbot configure

Or manually edit ~/.clawdbot/clawdbot.json and set:

{
  "update.auto": false,
  "update.check": false
}
#

Then restart once to apply.

The Heartbeat Angle

The empty heartbeat config is a red herring β€” it just means you're using defaults (30 min). The real problem is the gateway restart that resets the heartbeat timer. Each restart fires a fresh "[heartbeat] started" cycle.

What's in your clawdbot.json around update and gateway settings?

royal abyss
#

this is in the .json, I've not added the gateway token to the snippit

    "port": 18789,
    "mode": "local",
    "bind": "loopback",
    "auth": {
      "mode": "token",```

No cron jobs running either
misty sageBOT
# royal abyss this is in the .json, I've not added the gateway token to the snippit ``` "gat...

The snippet is cut off, but I don't see update settings there which is good. A few moreζŽ’ζŸ₯方向:

Check the full gateway config

clawdbot gateway call config.get --path gateway

Look for:

  • update.check (frequency of update checks)
  • update.auto (auto-download updates)
  • reload.mode (hot vs full restart)

Other potential culprits

1. Browser tool background sessions
If you're using the browser tool with background sessions, those can keep processes alive and sometimes trigger restarts on cleanup.

#

2. Plugin or agent issue
Some plugins or agents call update.run or gateway restart internally. Check:

clawdbot config get plugins

3. System-level timers
Even without cron jobs in clawdbot, check system timers:

systemctl list-timers --all
# or
crontab -l

4. Watchdog/monitoring
Do you have any external monitoring that might be calling:

#
clawdbot gateway call update.run

Debug the logs

Check what's actually happening at the restart moments:

clawdbot logs --tail | grep -E "(restart|update|config.apply|heartbeat)"

Or look for the exact trigger:

clawdbot logs --tail | grep -B5 "heartbeat.*started"

What does your full gateway section show? And are you running any plugins or custom agents that might be calling gateway operations?

royal abyss
#
error: unknown option '--path'
(Did you mean --auth?)
➜  ~ clawdbot config get plugins
error: too many arguments for 'config'. Expected 0 arguments but got 2.
➜  ~ clawdbot logs --tail | grep -E "(restart|update|config.apply|heartbeat)"
error: unknown option '--tail'
➜  ~ clawdbot logs --tail | grep -B5 "heartbeat.*started"
error: unknown option '--tail'```
misty sageBOT
#
# Get plugins
clawdbot config get

# Check logs (may need different syntax)
clawdbot logs
# or
clawdbot logs --help

The command syntax changed between versions. Once you share the version, I can give you the right commands for your setup! 🦐

royal abyss
#

version 2026.1.14-1

misty sageBOT
# royal abyss version 2026.1.14-1

Got it β€” version 2026.1.14-1 from Jan 14. That's very recent! Let me give you the right commands:

Correct Commands for Your Version

# Get full gateway config
clawdbot gateway call config.get

# Get your config (look for gateway, update, plugins sections)
clawdbot config get

# Check recent logs (no --tail flag in your version)
clawdbot logs

Quick Diagnose

#

Once you have those outputs, check for:

  1. gateway.update or update sections β€” look for check or auto settings
  2. plugins section β€” any plugins that might trigger restarts
  3. In the logs, look for lines containing:
    • update.run
    • config.apply
    • restart
    • [heartbeat] started

Common Culprits in Recent Versions

  • Auto-update in gateway config β€” some versions enable this by default
  • Plugin hot-reload β€” certain plugins trigger gateway reloads
  • Browser tool sessions β€” can sometimes cause restart cascades

Run those commands and paste the outputs β€” I'll help you spot what's triggering the restarts! 🦐

royal abyss
#

these return nothing ```➜ ~ clawdbot config get
error: too many arguments for 'config'. Expected 0 arguments but got 1.
➜ ~ clawdbot config get
error: too many arguments for 'config'. Expected 0 arguments but got 1.````

misty sageBOT
#
clawdbot --help

The config file will show you everything β€” look for:

  • gateway section (any update/auto settings?)
  • plugins section
  • update section at root level

Just paste the config file content (redact any tokens/keys) and I can point out what's causing the restarts! 🦐

royal abyss
#

I'm getting a lot of this in the gateway log [discord] gateway: Attempting resume with backoff: 1000ms [discord] gateway: WebSocket connection closed with code 1005 [discord] gateway: WebSocket connection closed with code 1006 [discord] gateway: Attempting resume with backoff: 1000ms after code 1006

misty sageBOT
# royal abyss I'm getting a lot of this in the gateway log ```[discord] gateway: Attempting re...

Found it! 🎯

The Discord WebSocket connection is failing with codes:

  • 1005 - Abnormal close (no status)
  • 1006 - Connection lost

This is causing the Discord gateway to disconnect/reconnect repeatedly, which resets the heartbeat cycle.

Common Causes for 1005/1006

  1. Network instability β€” WiFi dropping, ISP issues
  2. Firewall blocking Discord β€” check if your firewall is throttling Discord
  3. Rate limiting β€” too many events/actions triggering API calls
  4. Invalid/rotated token β€” Discord token got invalidated
  5. Discord API issues β€” rare but happens
  6. Too many concurrent connections β€” running multiple instances?
#

Quick Checks

# Test Discord connectivity
curl -I https://discord.com/api/v10/gateway

# Check your Discord token is still valid
curl -H "Authorization: YOUR_TOKEN" https://discord.com/api/v10/users/@me

What to Look For

  • Is this happening constantly or just periodically? Constant = network/token issue. Periodic = Discord API flakiness.
  • Do other Discord bots stay connected? If yes, it's your config. If no, it's network/Discord-wide.
  • Are you behind a VPN or firewall? Some networks block Discord's WebSocket endpoints.

The gateway restart is a symptom of the Discord connection failing. Fix the Discord connection, and the heartbeat issue resolves itself!

royal abyss
#
HTTP/2 200 
date: Fri, 16 Jan 2026 10:10:06 GMT
content-type: application/json
content-length: 35
cf-ray: 9becd2336ffe9bc3-LHR
cache-control: public, max-age=86400, s-maxage=86400
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-ratelimit-bucket: 0a6d458104b103c7be293cc9b284d9ee
x-ratelimit-limit: 100
x-ratelimit-remaining: 99
x-ratelimit-reset: 1768548572.318
x-ratelimit-reset-after: 0.010
x-discord-features: bots
via: 1.1 google
alt-svc: h3=":443"; ma=86400
last-modified: Fri, 16 Jan 2026 07:29:32 GMT
cf-cache-status: HIT
age: 4618
accept-ranges: bytes```
misty sageBOT
# royal abyss ```➜ ~ curl -I https://discord.com/api/v10/gateway HTTP/2 200 date: Fri, 16 Ja...

The REST API works fine, so the issue is WebSocket-specific. The WebSocket connection fails during the upgrade handshake.

WebSocket Diagnostic

# Check if WebSocket upgrade works (basic test)
curl -v -H "Connection: upgrade" -H "Upgrade: websocket" https://discord.com/api/v10/gateway

More Likely Causes

1. Token issue (WebSocket vs REST)
The REST API might accept a token that WebSocket rejects:

# Verify your token is valid (replace with your actual token)
curl -H "Authorization: YOUR_DISCORD_TOKEN" https://discord.com/api/v10/users/@me
#

If this fails, your token is invalid/rotated.

2. Proxy or VPN interference
WebSocket is more sensitive to proxies than HTTP. Are you using:

  • A VPN?
  • A corporate proxy?
  • Any network filtering?

3. DNS resolution
Discord's REST works but the gateway URL might resolve differently:

# Check gateway DNS
dig gateway.discord.gg

Quick Test

#

Do you have another Discord bot running on the same machine? If yes:

  • Does it stay connected while this one disconnects?

Or try temporarily:

  • Disabling any VPN/proxy
  • Testing from a different network

The 1006 suggests the connection drops mid-handshake β€” either network flakiness or something rejecting the WebSocket upgrade specifically.

royal abyss
#

I've added my discord token to the websocket vs REST check and hit this {"message": "401: Unauthorized", "code": 0}%

misty sageBOT
# royal abyss I've added my discord token to the websocket vs REST check and hit this ```{"mes...

There's your answer! 🎯

Your Discord token is invalid (401 Unauthorized). The token you're using has been:

  • Revoked
  • Rotated
  • Or is simply incorrect

Why REST worked earlier

The earlier curl -I https://discord.com/api/v10/gateway doesn't require a token β€” it just returns the gateway URL. Your token isn't being validated there.

But when the gateway tries to connect via WebSocket and authenticate, Discord rejects it β†’ 401 β†’ connection closes β†’ gateway restart.

Fix: Get a New Token

  1. Go to https://discord.com/developers/applications
  2. Select your bot application
#
  1. Go to Bot section

  2. Click Reset Token (or "Regenerate Token")

  3. Copy the new token

  4. Update your clawdbot config:

    clawdbot configure
    

    Or edit ~/.clawdbot/clawdbot.json and replace the old token.

  5. Restart clawdbot

Verify First

Before updating, double-check which token you're currently using:

grep -i discord ~/.clawdbot/clawdbot.json
#

That's the root cause β€” once you swap in a valid token, the WebSocket connection will hold, the gateway will stop restarting, and the heartbeat spam will stop! 🦐

royal abyss
#

ok, I'll see how that holds this morning now