openclaw - ✅(Solved) Fix [Bug]: message tool action=send to Discord fails with "Unknown Channel" despite bot being connected [1 pull requests, 3 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#78572Fetched 2026-05-07 03:35:11
View on GitHub
Comments
3
Participants
2
Timeline
7
Reactions
3
Author
Timeline (top)
commented ×3labeled ×2closed ×1cross-referenced ×1

The message tool action=send to Discord fails consistently with "Unknown Channel", even though:

  • The bot receives Discord DMs correctly (user can message the bot and I respond)
  • openclaw channels resolve discord:1439091261670948987 correctly resolves the user ID
  • Cron job announce delivery sometimes works (some Rheinmetall reports were delivered)
  • Bot is connected and shows OK in openclaw status

Error Message

  1. Result: Unknown Channel error

Root Cause

The message tool action=send to Discord fails consistently with "Unknown Channel", even though:

  • The bot receives Discord DMs correctly (user can message the bot and I respond)
  • openclaw channels resolve discord:1439091261670948987 correctly resolves the user ID
  • Cron job announce delivery sometimes works (some Rheinmetall reports were delivered)
  • Bot is connected and shows OK in openclaw status

Fix Action

Fixed

PR fix notes

PR #78625: fix(discord): parse provider-prefixed channel targets

Description (problem / solution / changelog)

Summary

  • Fixes #78572 by resolving bare numeric Discord message-tool targets through Discord's allowFrom-aware target resolver, so allowlisted DM user IDs route as user:<id> instead of being treated as channels.
  • Parse Discord provider-prefixed channel/user targets before the legacy discord:<id> DM shorthand, so discord:channel:<id> remains a channel target.
  • Preserve legacy discord:<userId> direct-message routing.
  • Add Discord-owned parser, normalizer, outbound route, outbound adapter, and plugin resolver coverage.

Fixes #78572.

Real behavior proof

Behavior addressed: Discord message(action="send") target resolution for the #78572 repro shape: a bare numeric Discord user ID that appears in channels.discord.allowFrom must route as user:<id> for DM delivery, not as channel:<id>. Also verifies provider-prefixed discord:channel:<id> routes as a channel target and can deliver a real Discord channel message.

Real environment tested: Local OpenClaw CLI built from this PR branch on macOS, using a temporary OPENCLAW_HOME/XDG_CONFIG_HOME and a temp Discord config with the local Discord bot token provided through DISCORD_BOT_TOKEN. The live channel delivery target was Discord channel 1501672157829140502.

Exact steps or command run after the patch:

  1. Create a temp OpenClaw home and patch config with channels.discord.enabled=true, channels.discord.token={ source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" }, and channels.discord.allowFrom=["*"].
  2. Run pnpm openclaw message send --channel discord --target "discord:channel:1501672157829140502" --message "OpenClaw live Discord delivery check for PR 78625 2026-05-06T21:25:34Z" --json.
  3. Separately run the #78572 target-resolution dry-run with channels.discord.allowFrom=["1439091261670948987"]: pnpm openclaw message send --channel discord --target "1439091261670948987" --message "dry-run allowFrom DM target check" --dry-run --json.

Evidence after fix: Live Discord channel delivery returned:

{
  "action": "send",
  "channel": "discord",
  "dryRun": false,
  "handledBy": "core",
  "payload": {
    "channel": "discord",
    "to": "channel:1501672157829140502",
    "via": "direct",
    "result": {
      "messageId": "1501696468438880377",
      "channel": "discord",
      "receipt": {
        "primaryPlatformMessageId": "1501696468438880377",
        "parts": [
          {
            "platformMessageId": "1501696468438880377",
            "kind": "text",
            "raw": {
              "channel": "discord",
              "messageId": "1501696468438880377",
              "channelId": "1501672157829140502"
            }
          }
        ]
      }
    }
  }
}

The #78572 bare numeric allowlisted DM dry-run returned:

{
  "action": "send",
  "channel": "discord",
  "dryRun": true,
  "handledBy": "core",
  "payload": {
    "channel": "discord",
    "to": "user:1439091261670948987",
    "via": "direct",
    "mediaUrl": null,
    "dryRun": true
  }
}

Observed result after fix: The provider-prefixed Discord channel target delivered a real Discord message with platform message id 1501696468438880377, and the #78572 bare numeric allowlisted Discord target resolves to user:1439091261670948987, which is the DM send target expected by Discord instead of channel:<id>.

What was not tested: Live Discord DM delivery to the #78572 reporter's user id was not run because we do not have that user's bot/channel relationship locally; the DM fix was verified at the target-resolution layer that produced the reported Unknown Channel misroute, and live channel delivery verified the Discord send path after provider-prefixed normalization.

Verification

  • pnpm exec oxfmt --check --threads=1 extensions/discord/src/channel.ts extensions/discord/src/channel.test.ts extensions/discord/src/target-parsing.ts extensions/discord/src/normalize.ts extensions/discord/src/targets.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/outbound-session-route.test.ts CHANGELOG.md
  • pnpm test extensions/discord/src/channel.test.ts extensions/discord/src/targets.test.ts extensions/discord/src/normalize.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/outbound-session-route.test.ts src/agents/tools/message-tool.test.ts -- --run

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/discord/src/channel.test.ts (modified, +27/-0)
  • extensions/discord/src/channel.ts (modified, +16/-0)
  • extensions/discord/src/normalize.ts (modified, +3/-0)
  • extensions/discord/src/outbound-adapter.test.ts (modified, +7/-0)
  • extensions/discord/src/outbound-session-route.test.ts (modified, +32/-0)
  • extensions/discord/src/target-parsing.ts (modified, +17/-0)
  • extensions/discord/src/targets.test.ts (modified, +6/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Bug Report: Discord message tool send fails with "Unknown Channel" in 2026.5.4

OpenClaw version: 2026.5.4 (upgraded from 2026.5.2) Runtime: Docker on TerraMaster NAS (F2-425), host network Channel: Discord (bot token, DM-only, allowFrom configured)

Summary

The message tool action=send to Discord fails consistently with "Unknown Channel", even though:

  • The bot receives Discord DMs correctly (user can message the bot and I respond)
  • openclaw channels resolve discord:1439091261670948987 correctly resolves the user ID
  • Cron job announce delivery sometimes works (some Rheinmetall reports were delivered)
  • Bot is connected and shows OK in openclaw status

Steps to reproduce

Steps to reproduce

  1. Configure Discord channel with bot token, dmPolicy: allowlist, allowFrom: ["<user_id>"]

  2. Attempt to send a DM using the message tool:

  3. Result: Unknown Channel error

Expected behavior

Expected behavior

Message should be delivered to the user's Discord DM.

Actual behavior

From gateway log:

[tools] message failed: Unknown Channel raw_params={"action":"send","message":"...","target":"1439091261670948987"}

Note: channels.resolve works fine: discord:1439091261670948987 -> 1439091261670948987

Additional context

  • This persisted through upgrade from 2026.5.2 → 2026.5.4
  • Restarting the gateway does not fix it
  • Cron announce delivery to the same Discord user sometimes works, sometimes fails
  • The bot is confirmed connected — user is actively messaging it right now

Suggested investigation

The discrepancy between:

  • channels.resolve succeeding (user ID is valid)
  • message send failing (Unknown Channel)
  • cron announce delivery sometimes succeeding

suggests the issue may be in how the message tool routes the target parameter vs. how the cron announce delivery resolves it. Possibly the tool's Discord send path is not using the resolved user ID correctly.

OpenClaw version

2026.5.4

Operating system

Linux 6.1.120+ x64

Install method

Docker ghcr.io/openclaw/openclaw:2026.5.4

Model

minimax/MiniMax-M2.7

Provider / routing chain

discord:1439091261670948987 (bot token, DM-only)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

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

Message should be delivered to the user's Discord DM.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING