openclaw - ✅(Solved) Fix [Bug]: Discord /new from thread crashes on GuildThreadChannel.parentId despite #68953 fix in 2026.4.20 [2 pull requests, 2 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#69861Fetched 2026-04-22 07:47:17
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Author
Participants
Timeline (top)
referenced ×3commented ×2cross-referenced ×2labeled ×2

Description Invoking /new from inside a Discord thread causes a crash with a partial channel access error. PR #68953 in 2026.4.20 added tolerance for partial Discord channel metadata in slash-command flows, but the GuildThreadChannel.parentId code path appears to have been missed.

Error Message

Invoking /new from inside a Discord thread causes a crash with a partial channel access error. PR #68953 in 2026.4.20 added tolerance for partial Discord channel metadata in slash-command flows, but the GuildThreadChannel.parentId code path appears to have been missed. Crash with the following error: Error: Cannot access rawData on partial Channel. Use fetch() to populate data.

Root Cause

Description Invoking /new from inside a Discord thread causes a crash with a partial channel access error. PR #68953 in 2026.4.20 added tolerance for partial Discord channel metadata in slash-command flows, but the GuildThreadChannel.parentId code path appears to have been missed.

Fix Action

Fix / Workaround

Error: Cannot access rawData on partial Channel. Use fetch() to populate data. at GuildThreadChannel.get rawData [as rawData] (@buape/carbon/src/abstracts/BaseChannel.ts:65:10) at GuildThreadChannel.get parentId [as parentId] (@buape/carbon/src/abstracts/BaseGuildChannel.ts:44:13) at dispatchDiscordCommandInteraction (extensions/discord/provider-CraktAkD.js:2451:47) at Command.run (extensions/discord/provider-CraktAkD.js:2367:4)

PR fix notes

PR #69905: fix(discord): guard partial channel access in /new slash command thread path

Description (problem / solution / changelog)

Fixes #69861.

Problem

When /new (or any plugin-dispatched slash command) is invoked inside a Discord thread, interaction.channel can be a partial Channel object. Accessing .parentId on it triggers Carbon's BaseChannel.rawData getter and throws:

Error: Cannot access rawData on partial Channel. Use fetch() to populate data.
    at GuildThreadChannel.get rawData [as rawData] (@buape/carbon/src/abstracts/BaseChannel.ts:65:10)
    at GuildThreadChannel.get parentId [as parentId] (@buape/carbon/src/abstracts/BaseGuildChannel.ts:44:13)
    at dispatchDiscordCommandInteraction (extensions/discord/provider-CraktAkD.js:2451:47)

Root cause

PR #68953 (landed in 2026.4.20) introduced the "parentId" in channel guard pattern at two call sites in extensions/discord/src/monitor/native-command.ts (lines 469 and 862), but missed the plugin-command dispatch path at line 1074 — which is exactly the path /new goes through.

Fix

Apply the same guard at the third site. Drop-in consistent with the pattern established by #68953, plus a nullish check on interaction.channel itself (the enclosing isThreadChannel computation already uses interaction.channel?.type, so interaction.channel can be nullish here).

const threadParentId =
  !isDirectMessage && isThreadChannel && interaction.channel && "parentId" in interaction.channel
    ? (interaction.channel.parentId ?? undefined)
    : undefined;

Verification

  • Mirrors the exact guard shape at lines 469 and 862 of the same file.
  • Triage swarm on the issue (comment) independently confirmed this is the offending line and the correct fix direction.
  • No behavior change for non-thread or fully-populated channel paths: "parentId" in is always true on fully-populated thread channels, so threadParentId still resolves to the parent id as before.

Changed files

  • extensions/discord/src/monitor/native-command.ts (modified, +3/-1)

PR #69908: fix(discord): read channel.parentId through safe accessor on partial thread channels

Description (problem / solution / changelog)

Summary

/new and other native Discord slash commands crash with Cannot access rawData on partial Channel. Use fetch() to populate data. whenever they are invoked from inside a thread and Discord delivers a partial GuildThreadChannel. The same crash also surfaces on the reaction preflight and the native model picker. Closes #69861.

Root cause

Carbon's GuildThreadChannel exposes parentId as a prototype getter that reads rawData. Several call sites guarded the read with "parentId" in channel ? channel.parentId : undefined. The in operator returns true for inherited accessor properties without invoking the getter, so the guard passed but the following property access still executed the getter and threw on partial channels.

The previous partial-channel hardening (#68953) only guaranteed safe reads for name, topic, and a few other keys via resolveDiscordChannelStringPropertySafe. parentId was still read with the plain in guard in five places across native-command.ts, native-command-ui.ts, and listeners.ts, so any /new, /status, /reset, custom slash command, reaction preflight, or model-picker interaction originating from a thread with a partial channel crashed at the same line.

Fix

  • Add resolveDiscordChannelParentIdSafe(channel) to extensions/discord/src/monitor/channel-access.ts. It reuses the existing resolveDiscordChannelStringPropertySafe helper, which already combines an in check with a try/catch around the property read, so a throwing getter returns undefined instead of propagating.
  • Replace the five unsafe channel.parentId reads with the new helper:
    • extensions/discord/src/monitor/native-command.ts (thread ingress preflight, authorization, and per-message threadParentId resolution)
    • extensions/discord/src/monitor/native-command-ui.ts (native autocomplete / model picker)
    • extensions/discord/src/monitor/listeners.ts (reaction preflight)

When the helper returns undefined, resolveDiscordThreadParentInfo already falls back to fetching the thread via resolveDiscordChannelInfo and then to an empty result, so thread-parent resolution degrades exactly like it does today for any other unresolvable parent.

Why the fix is safe

  • The new helper only narrows a read that already existed. No new data is inspected, no new branches are taken based on the value, and undefined was always an allowed output of the existing "parentId" in channel ? ... : undefined expression.
  • The downstream fallback (resolveDiscordChannelInfo + thread-id re-fetch) is the pre-existing code path for partial or unknown threads, so authorization inputs are at most as permissive as they were before.
  • Five direct replacements, one new small helper, and one regression test. No shared contract, schema, config, or public API changes.

Security / runtime controls unchanged

  • commands.allowFrom (global and provider-scoped) is evaluated against the same sender/guild/channel inputs.
  • channels.discord.groupPolicy and enforceOwnerForCommands gating are untouched; owner-candidate resolution does not depend on parentId.
  • Per-channel and per-thread allowlist / enabled config is still resolved through resolveDiscordChannelConfigWithFallback. When the safe accessor returns undefined, the thread lookup falls back to the thread's own id rather than an unverified parent id, which is at least as strict as the previous behavior.
  • No prompt-text-based authorization. No changes to provider auth, secrets, or outbound network behavior.

Tests run

  • pnpm test extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts (new regression + existing cases: 14 passed)
  • pnpm test extensions/discord/src/monitor/ (55 files, 508 tests passed)
  • pnpm test extensions/discord/ (122 files, 994 tests passed)
  • pnpm tsgo (core typecheck, clean)
  • pnpm format:check on touched files (clean)
  • pnpm lint:extensions scoped to the touched Discord files (no new errors; pre-existing errors on main in extensions/qa-lab and extensions/skill-workshop are unchanged and unrelated)

New regression test

native-command.commands-allowfrom.test.ts > "tolerates partial guild thread channels whose parentId getter throws" installs a throwing parentId getter on a PublicThread channel and asserts that defer and the dispatch spy still fire and that no unauthorized reply is produced. Fails on main with the reported error; passes with this change.

AI-assisted metadata

  • Fully tested locally with the commands above.
  • Bot review conversations will be handled by the author.

Made with Cursor

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/discord/src/monitor/channel-access.ts (modified, +8/-1)
  • extensions/discord/src/monitor/listeners.ts (modified, +5/-2)
  • extensions/discord/src/monitor/native-command-ui.ts (modified, +5/-2)
  • extensions/discord/src/monitor/native-command.commands-allowfrom.test.ts (modified, +48/-0)
  • extensions/discord/src/monitor/native-command.plugin-dispatch.test.ts (modified, +91/-0)
  • extensions/discord/src/monitor/native-command.ts (modified, +9/-6)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Description Invoking /new from inside a Discord thread causes a crash with a partial channel access error. PR #68953 in 2026.4.20 added tolerance for partial Discord channel metadata in slash-command flows, but the GuildThreadChannel.parentId code path appears to have been missed.

Steps to reproduce

Join a Discord thread (not a regular channel). Invoke the /new slash command. Observe crash.

Expected behavior

A fresh session starts normally.

Actual behavior

Crash with the following error:

Error: Cannot access rawData on partial Channel. Use fetch() to populate data. at GuildThreadChannel.get rawData [as rawData] (@buape/carbon/src/abstracts/BaseChannel.ts:65:10) at GuildThreadChannel.get parentId [as parentId] (@buape/carbon/src/abstracts/BaseGuildChannel.ts:44:13) at dispatchDiscordCommandInteraction (extensions/discord/provider-CraktAkD.js:2451:47) at Command.run (extensions/discord/provider-CraktAkD.js:2367:4)

OpenClaw version

2026.4.20

Operating system

macOS 26.3.1

Install method

npm global

Model

moonshot/kimi-k2.6

Provider / routing chain

openclaw -> moonshot

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 crash can likely be fixed by modifying the GuildThreadChannel code to handle partial channel metadata, specifically by using the fetch() method to populate the rawData before accessing it.

Guidance

  • Review the changes made in PR #68953 and ensure that the GuildThreadChannel.parentId code path is properly updated to handle partial Discord channel metadata.
  • Verify that the fetch() method is being used to populate the rawData before attempting to access it in the GuildThreadChannel class.
  • Check the dispatchDiscordCommandInteraction function in provider-CraktAkD.js to ensure that it is properly handling the case where the GuildThreadChannel has partial metadata.
  • Consider adding error handling to catch and log cases where the rawData is not populated, to help diagnose similar issues in the future.

Example

// Example of using fetch() to populate rawData
const channel = new GuildThreadChannel();
await channel.fetch(); // Populate rawData
const parentId = channel.parentId; // Now safe to access parentId

Notes

The fix may require updates to the @buape/carbon library, specifically in the BaseChannel.ts and BaseGuildChannel.ts files. Additionally, the provider-CraktAkD.js file may need to be updated to properly handle the case where the GuildThreadChannel has partial metadata.

Recommendation

Apply workaround: Modify the GuildThreadChannel code to use the fetch() method to populate the rawData before accessing it, as shown in the example above. This should prevent the crash and allow the /new command to work as expected.

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

A fresh session starts normally.

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 /new from thread crashes on GuildThreadChannel.parentId despite #68953 fix in 2026.4.20 [2 pull requests, 2 comments, 2 participants]