#Duplicate messages

1 messages · Page 1 of 1 (latest)

void flax
#

Why does my Claw keep sending duplicate message anytime it responds?

toxic tigerBOT
#

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

weak sirenBOT
#

Most “duplicate replies” end up being one of these:

1) You have two OpenClaw gateways running (often: service + a terminal, or VPS + laptop)

Both instances connect to Discord with the same bot token, both receive the same inbound event, both generate a reply → you see everything twice.

How to confirm:

  • On each machine where you’ve installed OpenClaw, run:
    • openclaw gateway status
  • Then watch logs while sending exactly one test message:
    • openclaw logs --follow
      If you see the same Discord message handled twice (same message id), you’ve got two runners.

Fix: stop/disable one of the gateways so only one instance is connected to Discord.

2) Your agent/skill is sending via the message tool and also returning normal text

That produces two outbound messages: one sent explicitly, plus the “final assistant reply”.

#

Common cause: custom AGENTS.md / skill prompt like “always respond using the message tool”.

Fix: either:

  • don’t use message.send for normal replies (just reply normally), or
  • if you do use message.send, ensure the model outputs NO_REPLY as the final text for that turn (so OpenClaw doesn’t also post the normal reply).

3) It’s not duplication — it’s streaming/chunking

If you enabled block streaming on Discord, one response can arrive as multiple messages (partial + continuation). That can look like “duplicates”.

Relevant docs: https://docs.openclaw.ai/concepts/messages (see “Streaming, chunking, and batching”)


Quick triage questions (answer any 2 and we can narrow it fast)

  1. Is it exactly 2 messages, back-to-back, and identical text?
  2. Are you running OpenClaw anywhere else (VPS + local, or terminal + background service)?
  3. What’s your openclaw --version?
#
  1. Paste ~20 lines around one duplicate from openclaw logs --follow (redact tokens).
void flax
#

Could it have been because I recently moved from VM to a local setup and my VM was still running?

weak sirenBOT
#

Yeah — that’s one of the most common causes.

If your VM was still running an OpenClaw gateway with the same Discord bot token, then both gateways were connected to Discord, both received the same inbound message event, and both produced a reply → you see duplicates.

How to confirm quickly:

  1. Stop the gateway on the VM (and make sure it won’t auto-start again):
  • openclaw gateway status
  • openclaw gateway stop
  • (if you installed it as a service/daemon, also disable it there)
  1. Send one test message in Discord.
  • If duplicates stop immediately: that was it.

If you’re not sure whether anything is still running on the VM, check logs on both sides while sending one test message:

  • openclaw logs --follow
#

Extra safety move (optional): if you can’t access the VM anymore / don’t trust it’s fully off, rotate the Discord bot token in the Discord Developer Portal and update the token in your current OpenClaw config. That guarantees the old instance can’t connect.

If this fixes it, please right-click the solution message → Apps → ✅ Mark Solution so Answer Overflow indexes it for the next person.

void flax
#

Would stopping the VM instance work for stopping the gateway?

weak sirenBOT
#

Stopping the VM usually stops the gateway (because the process can’t run if the VM is powered off), so yes — it will stop the duplicates as long as that VM is actually the “other” gateway.

But if you want to be sure (and prevent it coming back later), do one of these:

Option A (quick + reliable): power off the VM

  • Shut down / power off the VM completely (not just suspend).
  • Then send a test message in Discord and see if duplicates stop.

Option B (best practice): stop/disable the gateway inside the VM

Inside the VM:

  • openclaw gateway status
  • openclaw gateway stop

If it’s installed as a service, also disable it so it won’t restart on boot (exact command depends on how you installed it — systemd/pm2/etc).

Option C (nuclear, guarantees it): rotate the Discord bot token

If you can’t reliably control the VM or you’re not 100% sure it’s off:

#
  • Reset the bot token in the Discord Developer Portal
  • Update channels.discord.token in the current setup
    That immediately locks the old instance out.

If you do Option A and the duplicates still happen, that points to another second gateway somewhere (e.g. a background service on your local machine + one you started in a terminal).

void flax
#

"openclaw gateway status
file:///usr/lib/node_modules/openclaw/dist/entry.js:662
throw new Error(Unable to create fallback OpenClaw temp dir: ${fallbackPath});
^

Error: Unable to create fallback OpenClaw temp dir: /tmp/openclaw-1000
at ensureTrustedFallbackDir (file:///usr/lib/node_modules/openclaw/dist/entry.js:662:10)
at resolvePreferredOpenClawTmpDir (file:///usr/lib/node_modules/openclaw/dist/entry.js:679:10)
at file:///usr/lib/node_modules/openclaw/dist/entry.js:782:25
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:661:26)
at async tryImport (file:///usr/lib/node_modules/openclaw/openclaw.mjs:39:5)
at async file:///usr/lib/node_modules/openclaw/openclaw.mjs:50:5

Node.js v24.13.1
michaelikejiani2@opencode-tailscale:~$ openclaw gateway stop
file:///usr/lib/node_modules/openclaw/dist/entry.js:662
throw new Error(Unable to create fallback OpenClaw temp dir: ${fallbackPath});
^

Error: Unable to create fallback OpenClaw temp dir: /tmp/openclaw-1000
at ensureTrustedFallbackDir (file:///usr/lib/node_modules/openclaw/dist/entry.js:662:10)
at resolvePreferredOpenClawTmpDir (file:///usr/lib/node_modules/openclaw/dist/entry.js:679:10)
at file:///usr/lib/node_modules/openclaw/dist/entry.js:782:25
at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:661:26)
at async tryImport (file:///usr/lib/node_modules/openclaw/openclaw.mjs:39:5)
at async file:///usr/lib/node_modules/openclaw/openclaw.mjs:50:5

Node.js v24.13.1"

weak sirenBOT
#

Yep — that error is why openclaw gateway stop/status can’t run on the VM right now: OpenClaw can’t create (or doesn’t “trust”) its temp dir at /tmp/openclaw-1000.

Fastest way to stop the VM gateway anyway

If you installed the gateway as a service, you can stop it without the openclaw CLI:

Try user service first:

systemctl --user status openclaw-gateway.service
systemctl --user stop openclaw-gateway.service

If that says the unit doesn’t exist, try system service:

sudo systemctl status openclaw-gateway.service
sudo systemctl stop openclaw-gateway.service
#

(Ref: gateway runbook shows the unit name is typically openclaw-gateway[-<profile>].service: https://docs.openclaw.ai/gateway )

And yes: powering off the VM also stops it (as long as it’s not just “suspended”).


Fix the /tmp/openclaw-1000 problem (so CLI works again)

Run these on the VM and paste output:

id
ls -ld /tmp
ls -ld /tmp/openclaw-1000 || true

What usually fixes it:

#
  • /tmp should be drwxrwxrwt (mode 1777). If not:

    sudo chmod 1777 /tmp
    
  • If /tmp/openclaw-1000 exists but is owned by root / wrong perms (often from previously running OpenClaw as root), it’s safe to remove (it’s just a temp dir):

    sudo rm -rf /tmp/openclaw-1000
    

After that, openclaw gateway status / openclaw gateway stop should work again.

Once you stop the VM gateway, your Discord duplicates should go away immediately (since only one gateway instance will be replying).

void flax
weak sirenBOT
#

If it’s exactly 2 messages, identical, every time, and the VM is truly off, then it’s almost always still two gateways connected to Discord — just both on your Mac now (common combos):

  • macOS app’s bundled gateway + a CLI-installed background gateway (launchd)
  • background gateway + you also started openclaw gateway in a terminal
  • two profiles (e.g. default + --profile rescue) both running and both have Discord enabled

OpenClaw has inbound dedupe, but it can’t dedupe across two separate gateway processes.

Quick checks on the Mac

  1. What’s the exact output of:
openclaw --version
openclaw gateway status --deep
  1. Check if you have multiple launchd services:
#
launchctl list | grep -i openclaw

If you see more than one ai.openclaw... entry, you’ve likely got multiple gateways.

  1. Also check your config for multi-account Discord:
    Open ~/.openclaw/openclaw.json and look under channels.discord — if you have an accounts: { ... } block (or multiple accounts) make sure you’re not accidentally starting 2 Discord accounts with the same token.

Docs that match this situation: https://docs.openclaw.ai/gateway/multiple-gateways

If you paste (1) and (2) outputs, I can tell you exactly which extra gateway is the culprit and the cleanest one to stop.

void flax
#

.

#

1 and 2: "Service: LaunchAgent (loaded)
File logs: /tmp/openclaw/openclaw-2026-03-03.log
Command: /Users/michaelikejiani/.nvm/versions/node/v24.11.1/bin/node /Users/michaelikejiani/.nvm/versions/node/v24.11.1/lib/node_modules/openclaw/dist/index.js gateway --port 18789
Service file: ~/Library/LaunchAgents/ai.openclaw.gateway.plist
Service env: OPENCLAW_GATEWAY_PORT=18789

Service config looks out of date or non-standard.
Service config issue: Gateway service PATH missing required dirs: /Users/michaelikejiani/.nvm
Service config issue: Gateway service uses Node from a version manager; it can break after upgrades. (/Users/michaelikejiani/.nvm/versions/node/v24.11.1/bin/node)
Recommendation: run "openclaw doctor" (or "openclaw doctor --repair").
Config (cli): ~/.openclaw/openclaw.json
Config (service): ~/.openclaw/openclaw.json

Gateway: bind=loopback (127.0.0.1), port=18789 (service args)
Probe target: ws://127.0.0.1:18789
Dashboard: http://127.0.0.1:18789/
Probe note: Loopback-only gateway; only local clients can connect.

Runtime: running (pid 21055, state active)
RPC probe: ok

Listening: 127.0.0.1:18789
Troubles: run openclaw status
Troubleshooting: https://docs.openclaw.ai/troubleshooting
michaelikejiani@Michaels-MacBook-Air-3 ~ % launchctl list | grep -i openclaw
21055 -15 ai.openclaw.gateway"

weak sirenBOT
#

Paste got eaten 🙂

Run these on the Mac and paste the output (redact tokens if any show up):

openclaw --version
openclaw gateway status --deep
launchctl list | grep -i openclaw || true

Also: are you running the macOS app and have you ever run openclaw gateway install from the CLI? That combo is the classic “two gateways on one Mac” → two identical replies.

Once we see the launchctl lines + status --deep, we can tell you exactly which second instance to stop.

#

That output is helpful: it shows you have one Gateway running as a macOS LaunchAgent (ai.openclaw.gateway, pid 21055) on 127.0.0.1:18789.

But duplicates that are exactly 2 identical messages usually still means two gateways are connected to Discord — and the “other one” is typically either:

  • the macOS app (bundled gateway) running at the same time, or
  • a second Gateway on a different port/profile (so it won’t show up in that LaunchAgent line)

Confirm if there’s another gateway (best next command)

Run this on the Mac and paste the output:

openclaw gateway probe
openclaw channels status --probe
#

Quick “is it the macOS app?” test

If you’re running the macOS app: quit the app completely (not just close the window), then send one test message in Discord.

If duplicates stop → you were running app gateway + LaunchAgent gateway.

Fix (once we know which two are running)

You just need one gateway process to own Discord:

  • Keep the LaunchAgent: quit the macOS app gateway.
  • Or keep the macOS app: remove the LaunchAgent with:
    openclaw gateway uninstall
    
    (Only do this if you’re sure another gateway will stay running, otherwise your bot will go offline.)

Docs on multiple gateways: https://docs.openclaw.ai/gateway/multiple-gateways

#

Paste gateway probe + channels status --probe and I’ll tell you exactly which extra instance is still alive.

void flax
#

When I run the gateway probe stuff it says only 1 gateway

weak sirenBOT
#

If gateway probe really only shows one gateway, the next most likely “2 identical messages every time” causes on Discord are:

A) replyToMode: "all" (sends the same reply multiple times, once per message it decides to “reply to”)

This is especially likely if you’re replying to a message in Discord (so there’s reply context + current message).

Check/fix (in ~/.openclaw/openclaw.json):

  • Look for:
channels: {
  discord: {
    replyToMode: "all", // <- if this is set, try turning it off
  }
}

Set it to:

#
channels: { discord: { replyToMode: "off" } }

Then restart the gateway.

Docs mention this knob here (Discord config): https://docs.openclaw.ai/gateway/configuration-reference

Quick visual confirmation: are the two duplicate bot messages “replies” to different messages (you can click the little reply jump target)? If yes, this is almost certainly it.

B) Discord send is being retried (timeout/network) and the retry creates a duplicate

In that case the logs usually show a retry/timeout around the send.

To confirm, run:

openclaw logs --follow