openclaw - ✅(Solved) Fix [Bug]: Discord cron `announce` delivery to `user:<id>` is rewritten to `channel:<id>`, causing `Unknown Channel [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#74375Fetched 2026-04-30 06:24:45
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
2
Author
Timeline (top)
labeled ×2closed ×1commented ×1cross-referenced ×1

Discord cron announce delivery appears to lose the user: prefix for DM targets somewhere between cron job storage and outbound queue delivery.

Direct/manual Discord DM send works to the same user, but cron announce delivery fails with Unknown Channel.

Error Message

Error: Unknown Channel

Root Cause

Discord cron announce delivery appears to lose the user: prefix for DM targets somewhere between cron job storage and outbound queue delivery.

Direct/manual Discord DM send works to the same user, but cron announce delivery fails with Unknown Channel.

Fix Action

Fixed

PR fix notes

PR #74412: fix(cron): prefix Discord DM targets with user: in inferred delivery

Description (problem / solution / changelog)

Summary

Fixes #74375

When a cron job with delivery.mode: "announce" is created from a Discord DM session, inferDeliveryFromSessionKey extracts a bare numeric peer ID (e.g. 204737678510391296). When this bare ID later passes through Discord's normalizeDiscordMessagingTarget, it defaults to channel:204737678510391296 (since parseDiscordTarget uses defaultKind: "channel"), causing an Unknown Channel error.

Changes

  • inferDeliveryFromSessionKey now prefixes the to field with user: when the session key marker is direct or dm and the channel is discord
  • This is Discord-specific because Telegram uses unambiguous signed numeric IDs (negative for groups) and Slack uses string IDs, so they don't need disambiguation
  • Added 4 tests: Discord DM direct, Discord DM dm (legacy), Discord group (no prefix), Discord channel (no prefix)

Root Cause

src/agents/tools/cron-tool.ts:517 stored to: peerId as a bare string. Discord's target normalizer (extensions/discord/src/normalize.ts:5) calls parseDiscordTarget(raw, { defaultKind: "channel" }), which treats bare numeric IDs as channel IDs. The user: prefix makes the DM intent explicit.

Changed files

  • src/agents/tools/cron-tool.test.ts (modified, +52/-0)
  • src/agents/tools/cron-tool.ts (modified, +9/-1)

Code Example

"to": "user:204737678510391296"

---

"to": "channel:204737678510391296"

---

Error: Unknown Channel

---
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Discord cron announce delivery appears to lose the user: prefix for DM targets somewhere between cron job storage and outbound queue delivery.

Direct/manual Discord DM send works to the same user, but cron announce delivery fails with Unknown Channel.

Steps to reproduce

Use an isolated cron job with:

  • delivery.mode: "announce"
  • delivery.channel: "discord"
  • `delivery.to: "user:<id>"

Force-run it.

Expected behavior

The cron job is stored correctly with:

"to": "user:204737678510391296"

the message should be sent to the respective userID as a PM

Actual behavior

But the queued delivery artifact contains:

"to": "channel:204737678510391296"

The run then fails with:

Error: Unknown Channel

OpenClaw version

OpenClaw 2026.4.12

Operating system

NixOS Unstable

Install method

nix ENV

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw --> token connect codex

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

openclaw-discord-cron-dm-bug-report-detailed.md

extent analysis

TL;DR

The user: prefix is lost when storing or retrieving the cron job, resulting in an Unknown Channel error, and a potential fix involves ensuring the prefix is preserved throughout the delivery process.

Guidance

  • Verify that the delivery.to field is correctly formatted as user:<id> when storing the cron job and when it's retrieved for delivery.
  • Check the code responsible for transforming or processing the delivery.to field between storage and delivery to ensure it doesn't inadvertently remove the user: prefix.
  • Inspect the database or storage mechanism used by the cron job to confirm that the user: prefix is indeed stored correctly and not modified upon retrieval.
  • Review the documentation or implementation of the Discord API integration to ensure that it correctly handles the user: prefix for direct messages.

Example

No specific code example can be provided without more context on the implementation, but ensuring that the user: prefix is consistently applied and preserved in the delivery.to field is crucial.

Notes

The issue seems to be related to how the delivery.to field is processed or transformed between the cron job storage and the outbound queue delivery. Without access to the specific codebase or more detailed logs, pinpointing the exact cause or providing a definitive fix is challenging.

Recommendation

Apply a workaround to manually ensure the user: prefix is correctly applied and preserved in the delivery.to field throughout the cron job's lifecycle, as the root cause of the prefix loss is not immediately clear from the provided information.

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

The cron job is stored correctly with:

"to": "user:204737678510391296"

the message should be sent to the respective userID as a PM

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 `announce` delivery to `user:<id>` is rewritten to `channel:<id>`, causing `Unknown Channel [1 pull requests, 1 comments, 2 participants]