-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: EmbeddedAttemptSessionTakeoverError during Discord runs: session file changed while embedded prompt lock was released #86508
Copy link
Copy link
Open
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.regressionBehavior that previously worked and now failsBehavior that previously worked and now fails
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingSomething isn't workingclawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.regressionBehavior that previously worked and now failsBehavior that previously worked and now fails
Type
Fields
Give feedbackNo fields configured for issues without a type.
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
2026.5.22 (a374c3a)on macOS 26.5 arm64 with Node 26.0.0.EmbeddedAttemptSessionTakeoverError: session file changed while embedded prompt lock was released.Troubleshooting already tried:
openclaw doctor --fixopenclaw gateway restartpgrep/ps~/.openclaw/agents/main/sessionsaside and started with a fresh sessions directoryExpected 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>.jsonlOpenClaw 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.jsonlImpact 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.