openclaw - 💡(How to fix) Fix [Bug]: sessions_spawn fails with thread_binding_invalid on Discord channels [1 comments, 2 participants]

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…
GitHub stats
openclaw/openclaw#70315Fetched 2026-04-23 07:26:25
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
closed ×1commented ×1

Spawning a Codex ACP session as a thread from a top-level Discord channel fails with thread_binding_invalid on [email protected].

Error Message

Turning on verbose logging and working backwards, the conversationId reaching the binding adapter has a channel: prefix on it (my channel id came through as channel:<snowflake> rather than just <snowflake>). That gets handed to Discord's REST API where it 404s. The 404 looks like it's caught by a logVerbose so the outer error is the generic thread_binding_invalid rather than the 404 itself.

Root Cause

Spawning a Codex ACP session as a thread from a top-level Discord channel fails with thread_binding_invalid on [email protected].

Code Example

errorCode: "thread_binding_invalid"
Session binding adapter failed to bind target conversation

---

const conversationId = normalizeOptionalString(input.conversation.conversationId) ?? "";
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Spawning a Codex ACP session as a thread from a top-level Discord channel fails with thread_binding_invalid on [email protected].

Steps to reproduce

  1. Send a message in a Discord channel where the agent is active
  2. Ask the agent to open a Codex ACP session as a thread (sessions_spawn with runtime="acp", thread=true)
  3. Spawn fails before a thread is created

Expected behaviour

A new thread gets created in the channel and the ACP session is bound to it. This is what happens when I create the thread manually first and then bind ACP to that thread - so the end-state works, just not via the agent-initiated path.

Actual behaviour

The spawn errors with:

errorCode: "thread_binding_invalid"
Session binding adapter failed to bind target conversation

No thread is created.

OpenClaw version

2026.4.21

Logs, screenshots, and evidence

Turning on verbose logging and working backwards, the conversationId reaching the binding adapter has a channel: prefix on it (my channel id came through as channel:<snowflake> rather than just <snowflake>). That gets handed to Discord's REST API where it 404s. The 404 looks like it's caught by a logVerbose so the outer error is the generic thread_binding_invalid rather than the 404 itself.

Grepping for where the conversationId gets set ended at this line in dist/extensions/discord/thread-bindings.manager-*.js (line 414 on 4.21 for me):

const conversationId = normalizeOptionalString(input.conversation.conversationId) ?? "";

I can't tell for sure where the channel: / user: / dm: prefix is being prepended upstream. It does look like this spot isn't stripping it before passing to Discord, though. Stripping the prefix locally does make the spawn succeed, at least on my machine.

Impact and severity

Affected: Discord users trying to spawn ACP sessions as threads directly from a channel message. Severity: Annoying - blocks the agent-initiated thread workflow. Frequency: Always (observed on every attempt). Consequence: Users have to create the thread manually first and bind ACP to it, which defeats the point of thread=true on the spawn.

Additional information

This used to work for me on an earlier version but I can't remember which one - sorry, that's the best I've got for a last-known-good. First known bad on my end is 2026.4.10, and I've been running a small local edit at that line since 2026-04-11 that strips a leading channel: / user: / dm: from the conversationId before it's passed on. That has kept the spawn working for me since.

extent analysis

TL;DR

The most likely fix is to strip the channel: prefix from the conversationId before passing it to Discord's REST API.

Guidance

  • Verify that the conversationId is being prepended with a channel: prefix by checking the logs or debugging the code.
  • Investigate where the prefix is being added and remove it before passing the conversationId to the Discord API.
  • Consider modifying the thread-bindings.manager-*.js file to strip the prefix, similar to the local edit made by the user.
  • Test the fix by spawning a Codex ACP session as a thread from a top-level Discord channel and verify that the thread is created successfully.

Example

const conversationId = input.conversation.conversationId.replace(/^channel:/, '');

This code snippet strips the channel: prefix from the conversationId before passing it to the Discord API.

Notes

The fix may not work if the prefix is added elsewhere in the code or if there are other issues with the conversationId. Additional debugging and testing may be necessary to ensure the fix works correctly.

Recommendation

Apply the workaround by stripping the channel: prefix from the conversationId before passing it to the Discord API, as this has been shown to fix the issue in the user's local environment.

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…

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]: sessions_spawn fails with thread_binding_invalid on Discord channels [1 comments, 2 participants]