openclaw - 💡(How to fix) Fix [Bug]: EmbeddedAttemptSessionTakeoverError during Discord runs: session file changed while embedded prompt lock was released

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…

Discord channel run fails after preview/status text disappears, Exact error: EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released, Already tried doctor --fix, gateway restart, confirmed only one gateway process, and reset ~/.openclaw/agents/main/sessions

Error Message

13:28:05+00:00 warn plugins {"subsystem":"plugins"} [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: discord (/Users/oc-bbbb1/.openclaw/npm/node_modules/@openclaw/discord/dist/index.js). Set plugins.allow to explicit trusted ids. 13:30:20+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=134984 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl" 13:30:20+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:discord:channel:1506687198391697559 durationMs=134987 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl" 13:30:20+00:00 error Embedded agent failed before reply: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl 13:35:03+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=26222 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl" 13:35:03+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:discord:channel:1506687198391697559 durationMs=26223 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl" 13:35:03+00:00 error Embedded agent failed before reply: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl

Root Cause

Discord channel run fails after preview/status text disappears, Exact error: EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released, Already tried doctor --fix, gateway restart, confirmed only one gateway process, and reset ~/.openclaw/agents/main/sessions

Code Example

13:28:05+00:00 warn plugins {"subsystem":"plugins"} [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: discord (/Users/oc-bbbb1/.openclaw/npm/node_modules/@openclaw/discord/dist/index.js). Set plugins.allow to explicit trusted ids.
13:30:20+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=134984 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:30:20+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:discord:channel:1506687198391697559 durationMs=134987 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:30:20+00:00 error Embedded agent failed before reply: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl
13:35:03+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=26222 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:35:03+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:discord:channel:1506687198391697559 durationMs=26223 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:35:03+00:00 error Embedded agent failed before reply: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Discord channel run fails after preview/status text disappears, Exact error: EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released, Already tried doctor --fix, gateway restart, confirmed only one gateway process, and reset ~/.openclaw/agents/main/sessions

Steps to reproduce

  1. Run OpenClaw 2026.5.22 (a374c3a) on macOS 26.5 arm64 with Node 26.0.0.
  2. Use Discord channel integration with one LaunchAgent gateway process running.
  3. Send a simple message to the Discord bot. It may reply successfully.
  4. Send a more complex request that causes the embedded agent to use tools / run longer.
  5. Discord shows the eye/status preview text, then the preview disappears and no final reply is sent.
  6. Gateway logs show EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released.

Troubleshooting already tried:

  • openclaw doctor --fix
  • openclaw gateway restart
  • Confirmed only one gateway process with pgrep / ps
  • Moved ~/.openclaw/agents/main/sessions aside and started with a fresh sessions directory
  • Re-tested and got the same error

Expected behavior

Discord requests should complete with a final reply, even for longer/tool-using runs. The session transcript should not be modified in a way that causes the embedded agent to abort its own run.

Actual behavior

For longer Discord requests, OpenClaw starts the run and shows Discord preview/status text, but then the preview disappears and no final reply is delivered. The gateway logs repeatedly show:

EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/<session-id>.jsonl

OpenClaw version

2026.5.22 (a374c3a)

Operating system

macOS 26.5 arm64, Node 26.0.0,

Install method

Homebrew/global npm-style install on macOS. CLI path from status: /opt/homebrew/bin/openclaw. Gateway command: /opt/homebrew/opt/node/bin/node /opt/homebrew/lib/node_modules/openclaw/dist/index.js gateway --port 18789. Gateway runs as macOS LaunchAgent.

Model

From gateway logs: anthropic/claude-opus-4-7, thinking=medium, fast=off.

Provider / routing chain

Discord channel integration -> main agent -> embedded agent run. Affected session key in logs: agent:main:discord:channel:1506687198391697559.

Additional provider/model setup details

Discord status/probe reports healthy: token configured, gateway reachable, connected, works, audit ok. Message Content Intent is reported as limited, but available for bots under 100 servers. No known provider auth error appears in the pasted logs.

Logs, screenshots, and evidence

13:28:05+00:00 warn plugins {"subsystem":"plugins"} [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: discord (/Users/oc-bbbb1/.openclaw/npm/node_modules/@openclaw/discord/dist/index.js). Set plugins.allow to explicit trusted ids.
13:30:20+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=134984 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:30:20+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:discord:channel:1506687198391697559 durationMs=134987 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:30:20+00:00 error Embedded agent failed before reply: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl
13:35:03+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=main durationMs=26222 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:35:03+00:00 error diagnostic {"subsystem":"diagnostic"} lane task error: lane=session:agent:main:discord:channel:1506687198391697559 durationMs=26223 error="EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl"
13:35:03+00:00 error Embedded agent failed before reply: session file changed while embedded prompt lock was released: /Users/oc-bbbb1/.openclaw/agents/main/sessions/7549b99f-9075-4826-af0d-3e1fae4a99b9.jsonl

Impact and severity

Discord bot becomes unreliable for longer/tool-using requests. It may reply to simple messages, but complex requests show preview/status text and then fail without a final reply.

Medium to high. Core Discord usage is partially broken: simple replies may work, but real troubleshooting/tool-using requests fail repeatedly even after doctor, restart, single-process verification, and session reset.

Additional information

I tried solving this through the openclaw discord agent, krill.

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

Discord requests should complete with a final reply, even for longer/tool-using runs. The session transcript should not be modified in a way that causes the embedded agent to abort its own run.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING