openclaw - ✅(Solved) Fix [Bug]: Discord cron delivery fix — 2026-04-02 [1 pull requests, 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#62024Fetched 2026-04-08 03:10:11
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×2commented ×1cross-referenced ×1referenced ×1

Error Message

Symptom: Cron job delivers successfully in openclaw-2026.3.12 but fails with Error: Unknown Channel in openclaw-2026.4.2. deliveryStatus: "unknown", consecutiveErrors: 5. 4. Discord API returns Unknown Channel (error 10003) — the ID is a user ID, not a channel Cron job delivers successfully in openclaw-2026.3.12 but fails with Error: Unknown Channel in openclaw-2026.4.2. deliveryStatus: "unknown", consecutiveErrors: 5.

Root Cause

Root cause: parseDiscordExplicitTarget in extensions/discord/src/channel.ts returned target.id (bare numeric ID) instead of target.normalized (prefixed string). This caused a chain of wrong transformations:

Fix Action

Fixed

PR fix notes

PR #62052: fix(discord): preserve normalized prefix in explicit target parsing

Description (problem / solution / changelog)

parseDiscordExplicitTarget returned target.id (bare numeric like "148297...") instead of target.normalized (prefixed like "user:148297..."). Downstream, normalizeDiscordOutboundTarget matches the bare digits against a numeric regex and wrongly prepends channel:, routing user DMs to a non-existent channel (Discord API error 10003).

One-field fix: target.idtarget.normalized. This also corrects inferTargetChatType (line 495), which re-parses the to value — previously a bare ID with defaultKind: "channel" would misclassify user targets.

Fixes #62024

Testing

4 new tests through the public discordPlugin.messaging.parseExplicitTarget interface:

  • user:<id> → preserves prefix, chatType = direct
  • channel:<id> → preserves prefix, chatType = channel
  • bare numeric → defaults to channel (existing behavior)
  • invalid input → null

All 17 tests pass (13 pre-existing + 4 new).

Changed files

  • extensions/discord/src/channel.test.ts (modified, +29/-0)
  • extensions/discord/src/channel.ts (modified, +1/-1)

Code Example

// Before
return {
  to: target.id,
  chatType: target.kind === "user" ? ("direct" as const) : ("channel" as const),
};

// After
return {
  to: target.normalized,
  chatType: target.kind === "user" ? ("direct" as const) : ("channel" as const),
};

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Discord cron delivery fix — 2026-04-02

Symptom: Cron job delivers successfully in openclaw-2026.3.12 but fails with Error: Unknown Channel in openclaw-2026.4.2. deliveryStatus: "unknown", consecutiveErrors: 5.

Cron job: 89212ad4-59de-44c6-a4ae-xxx (Iran/Israel conflict updates)

  • delivery.channel: "discord", delivery.to: "user:148297430xxx"

Root cause: parseDiscordExplicitTarget in extensions/discord/src/channel.ts returned target.id (bare numeric ID) instead of target.normalized (prefixed string). This caused a chain of wrong transformations:

  1. to = "user:148297430103xxx"parseDiscordExplicitTarget extracts target.id"1482974301035696148" (prefix stripped)
  2. normalizeDiscordOutboundTarget("14829743010xxx") sees bare number → prepends "channel:""channel:1482974301035xxx"
  3. sendMessageDiscord("channel:14829743010xxx") treats it as a channel ID (not a user DM)
  4. Discord API returns Unknown Channel (error 10003) — the ID is a user ID, not a channel

Fix: extensions/discord/src/channel.ts line 277 — change target.id to target.normalized:

// Before
return {
  to: target.id,
  chatType: target.kind === "user" ? ("direct" as const) : ("channel" as const),
};

// After
return {
  to: target.normalized,
  chatType: target.kind === "user" ? ("direct" as const) : ("channel" as const),
};

target.normalized preserves the kind prefix (e.g. "user:148297430xxx"), so normalizeDiscordOutboundTarget leaves it unchanged and sendMessageDiscord correctly creates a DM channel via POST /users/@me/channels.

Steps to reproduce

Cron job delivers successfully in openclaw-2026.3.12 but fails with Error: Unknown Channel in openclaw-2026.4.2. deliveryStatus: "unknown", consecutiveErrors: 5.

Expected behavior

Discord cron delivery fixed — 2026.4.2

Actual behavior

Discord cron delivery fixed — 2026.4.2

OpenClaw version

2026.4.2

Operating system

Win 11

Install method

No response

Model

🦞 OpenClaw 2026.4.2 🧠 Model: cherry-ollama/qwen3-coder-next:cloud

Provider / routing chain

Discord cron delivery

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The most likely fix is to update the parseDiscordExplicitTarget function in extensions/discord/src/channel.ts to return target.normalized instead of target.id.

Guidance

  • Verify that the issue is caused by the parseDiscordExplicitTarget function returning a bare numeric ID instead of a prefixed string by checking the delivery.to value in the cron job.
  • Update the parseDiscordExplicitTarget function to return target.normalized as shown in the provided code snippet.
  • Test the updated function to ensure that it correctly preserves the kind prefix and allows normalizeDiscordOutboundTarget to leave it unchanged.
  • Verify that the sendMessageDiscord function correctly creates a DM channel via POST /users/@me/channels after the update.

Example

return {
  to: target.normalized,
  chatType: target.kind === "user" ? ("direct" as const) : ("channel" as const),
};

Notes

This fix assumes that the target.normalized property contains the correct prefixed string. If this is not the case, additional debugging may be required to determine the correct value to return.

Recommendation

Apply the workaround by updating the parseDiscordExplicitTarget function to return target.normalized instead of target.id, as this should fix the issue with the Discord cron delivery.

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 cron delivery fixed — 2026.4.2

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 - ✅(Solved) Fix [Bug]: Discord cron delivery fix — 2026-04-02 [1 pull requests, 1 comments, 2 participants]