openclaw - 💡(How to fix) Fix [Bug]: EmbeddedAttemptSessionTakeoverError causes duplicate Discord responses when webchat session is active

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…

Every inbound Discord channel message triggers two agent responses when a webchat (or other direct) session is active simultaneously under the same agent. The root cause is two lanes competing for the same session file lock on every inbound Discord event.

Error Message

lane task error: lane=main durationMs=XXXX error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /home/will/.openclaw/agents/discord-ops/sessions/<session-id>.jsonl"

lane task error: lane=session:agent:discord-ops:discord:channel:1482518719090659400 durationMs=XXXX error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /home/will/.openclaw/agents/discord-ops/sessions/<session-id>.jsonl"

Root Cause

Every inbound Discord channel message triggers two agent responses when a webchat (or other direct) session is active simultaneously under the same agent. The root cause is two lanes competing for the same session file lock on every inbound Discord event.

Fix Action

Workaround

Using Discord as the only active channel (no concurrent webchat session) eliminates the contention. Not practical for users who switch between webchat and Discord.

Code Example

lane task error: lane=main durationMs=XXXX error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /home/will/.openclaw/agents/discord-ops/sessions/<session-id>.jsonl"

lane task error: lane=session:agent:discord-ops:discord:channel:1482518719090659400 durationMs=XXXX error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /home/will/.openclaw/agents/discord-ops/sessions/<session-id>.jsonl"

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Last login: Mon May 18 16:33:31 on ttys003 orvillewright@Wilbur-Wright-Mac-Mini ~ % http://localhost:18889/ zsh: no such file or directory: http://localhost:18889/ orvillewright@Wilbur-Wright-Mac-Mini ~ % ssh -N -L 18889:127.0.0.1:18789 [email protected]

channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused channel 2: open failed: connect failed: Connection refused Read from remote host 5.78.180.61: Connection reset by peer client_loop: send disconnect: Broken pipe orvillewright@Wilbur-Wright-Mac-Mini ~ % orvillewright@Wilbur-Wright-Mac-Mini ~ % orvillewright@Wilbur-Wright-Mac-Mini ~ % orvillewright@Wilbur-Wright-Mac-Mini ~ % ~/.openclaw/workspace/github-issue-discord-double-response.md zsh: no such file or directory: /Users/orvillewright/.openclaw/workspace/github-issue-discord-double-response.md orvillewright@Wilbur-Wright-Mac-Mini ~ % ssh [email protected]
orvillewright@Wilbur-Wright-Mac-Mini ~ % $ ssh -N -L 18889:127.0.0.1:18789 [email protected] zsh: command not found: $ orvillewright@Wilbur-Wright-Mac-Mini ~ % $ ssh [email protected] zsh: command not found: $ orvillewright@Wilbur-Wright-Mac-Mini ~ % ssh [email protected]
Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 6.8.0-117-generic x86_64)

System information as of Wed May 20 08:29:06 PM UTC 2026

System load: 0.14 Processes: 179 Usage of /: 12.0% of 225.00GB Users logged in: 1 Memory usage: 7% IPv4 address for eth0: 5.78.219.9 Swap usage: 0% IPv6 address for eth0: 2a01:4ff:1f0:54b1::1

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

14 additional security updates can be applied with ESM Apps. Learn more about enabling ESM Apps service at https://ubuntu.com/esm

Last login: Wed May 20 19:12:30 2026 from 104.172.241.200 will@snapshot-388658853-ubuntu-16gb-hil-1:$ $ ssh -N -L 18889:127.0.0.1:18789 [email protected]^C will@snapshot-388658853-ubuntu-16gb-hil-1:$ will@snapshot-388658853-ubuntu-16gb-hil-1:~$ /.openclaw/workspace/github-issue-discord-double-response.md -bash: /home/will/.openclaw/workspace/github-issue-discord-double-response.md: Permission denied will@snapshot-388658853-ubuntu-16gb-hil-1:$ ssh will@<your-vps-ip> cat ~/.openclaw/workspace/github-issue-discord-double-response.md -bash: syntax error near unexpected token `newline'

Bug: EmbeddedAttemptSessionTakeoverError causes duplicate Discord responses when webchat session is active

URL to file: https://github.com/openclaw/openclaw/issues/new


Summary

Every inbound Discord channel message triggers two agent responses when a webchat (or other direct) session is active simultaneously under the same agent. The root cause is two lanes competing for the same session file lock on every inbound Discord event.

Environment

  • OpenClaw version: 2026.5.18
  • OS: Ubuntu 22.04, Linux 6.8.0 (x64)
  • Node: v22.22.2
  • Agent: single discord-ops agent
  • Channels: Discord + webchat (both active simultaneously)
  • Models: anthropic/claude-sonnet-4-6 primary

Reproduction Steps

  1. Configure a single agent (discord-ops) with both a Discord channel and a webchat session active
  2. Have an active webchat conversation running (i.e. lane=main is live)
  3. Send a message in the Discord channel
  4. Observe: two responses appear in Discord

Log Evidence

Every inbound Discord message produces this pair of errors in the gateway log:

lane task error: lane=main durationMs=XXXX error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /home/will/.openclaw/agents/discord-ops/sessions/<session-id>.jsonl"

lane task error: lane=session:agent:discord-ops:discord:channel:1482518719090659400 durationMs=XXXX error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /home/will/.openclaw/agents/discord-ops/sessions/<session-id>.jsonl"

Both lanes fail, both retry, both succeed on retry → two replies delivered to Discord.

What Was Tried (Did Not Fix)

  • Removing stale name-based session keys (#one, willw2168) from sessions.json
  • Setting channels.discord.dangerouslyAllowNameMatching: false
  • Setting channels.discord.threadBindings.enabled: false
  • Removing Qwen fallback from the agent model config
  • Resetting the Discord channel session (deleting its sessions.json entry)
  • Adding session.sendPolicy to deny Discord channel messages from keyPrefix: agent:discord-ops:main

None of these prevented lane=main from acquiring a lock on the Discord channel session file.

Expected Behavior

When a message arrives on a Discord channel session (lane=session:agent:discord-ops:discord:channel:<id>), lane=main (webchat/direct session) should not compete for the same session file. The two lanes should be isolated — Discord channel messages should only be processed by the channel lane.

Actual Behavior

Both lane=main and lane=session:agent:discord-ops:discord:channel:<id> attempt to write to the same .jsonl session file simultaneously. Both hit EmbeddedAttemptSessionTakeoverError, both retry, both complete successfully, resulting in duplicate responses sent to Discord.

Workaround

Using Discord as the only active channel (no concurrent webchat session) eliminates the contention. Not practical for users who switch between webchat and Discord.

Additional Context

  • The issue persists across gateway restarts
  • It appears on every single inbound Discord message as long as a webchat session is active
  • The lane=main takeover error timestamp matches exactly with Discord message arrival timestamps
  • No duplicate events from Discord's side — confirmed single message_id arriving twice in session context

Steps to reproduce

  1. Writing anything in Discord is seen twice by the Discord Server.

Expected behavior

Would expect it to only see it once.

Actual behavior

It seeing everything I type twice and I sometimes get duplicate responses where it says it can't do something and then does it immediately afterwards. This is especially true for Gog related tasks.

OpenClaw version

2026.5.18

Operating system

macOS Tahoe v 26.4.1

Install method

npm global

Model

anthropic/claude-sonnet-4-6

Provider / routing chain

Direct — no intermediate proxy or secondary model

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Discord users annoying always strange output from Discord

Additional information

Used to work correctly and something has broken. Have been trying to debug / fix with Openclaw control, but no go.

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…

FAQ

Expected behavior

Would expect it to only see it once.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: EmbeddedAttemptSessionTakeoverError causes duplicate Discord responses when webchat session is active