openclaw - 💡(How to fix) Fix [Bug] Discord REST final-reply and slash-command failures after undici v7 → v8 bump (2026.4.5) [1 comments, 1 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#62345Fetched 2026-04-08 03:05:40
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
commented ×1

After upgrading from 2026.4.2 to 2026.4.5, all Discord REST deliveries start failing:

  1. Agent replies disappear — streaming/partial content shows briefly, then the final reply edit fails and the message vanishes from Discord.
  2. Slash commands hang/status, /new, /reset never return a response. Discord shows "application did not respond."

The root cause is the undici ^7.24.6 → ^8.0.1 major version bump between these two releases.

Error Message

[discord] final reply failed: Error: {"_misc": ["Expected "Content-Type" header to be one of {'application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'}."]} at ProxyRequestClientCompat.executeRequest (…/dist/send-DezGS_D4.js:567:27) at ProxyRequestClientCompat.processQueue (…/dist/send-DezGS_D4.js:578:21)

Root Cause

The behavioral difference between undici v7 and v8 is visible in the proxy-preload.cjs startup log:

Versionundiciproxy-preload log
2026.4.2^7.24.6EnvHttpProxyAgent active, proxy=http://127.0.0.1:…
2026.4.5^8.0.1EnvHttpProxyAgent active, proxy=http://127.0.0.1:… **(dispatcher locked)**

In undici v8, EnvHttpProxyAgent locks the global dispatcher. This interferes with ProxyRequestClientCompat.executeRequest() in send-DezGS_D4.js, which constructs a Headers object, sets Content-Type: application/json (line 530), and calls fetch() with the headers. When the global dispatcher is locked, the Content-Type header is dropped or not forwarded to the Discord API.

Verification steps performed:

  1. Proxy itself is not the issuecurl --proxy <proxy> -X PATCH -H "Content-Type: application/json" -d '{}' https://discord.com/api/v10/channels/0/messages/0 returns HTTP 401 (expected), not Content-Type error.
  2. undici ProxyAgent works in isolation — Direct test with OpenClaw's bundled undici v8 ProxyAgent + explicit Content-Type header through the same proxy returns HTTP 401 correctly. The issue only manifests when EnvHttpProxyAgent has locked the global dispatcher.
  3. Downgrade confirms — Reverting to 2026.4.2 (undici v7) immediately eliminates all Content-Type errors and restores normal Discord message delivery and slash command handling.

Fix Action

Workaround

Downgrade to 2026.4.2:

npm install -g [email protected]

The only config incompatibility is plugins.entries.memory-core.config.dreaming (added in 4.5, not recognized by 4.2) — remove it or set the entry to {}.

Code Example

[discord] final reply failed: Error: {"_misc": ["Expected \"Content-Type\" header to be one of
  {'application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'}."]}
    at ProxyRequestClientCompat.executeRequest (/dist/send-DezGS_D4.js:567:27)
    at ProxyRequestClientCompat.processQueue (/dist/send-DezGS_D4.js:578:21)

---

DiscordError: Interaction has already been acknowledged.
  status: 400, discordCode: 40060

[EventQueue] Slow listener detected: InteractionEventListener took 37037ms for event INTERACTION_CREATE

[discord] slash final reply failed: Error: {"_misc": ["Expected \"Content-Type\" header …"]}

---

npm install -g openclaw@2026.4.2
RAW_BUFFERClick to expand / collapse

Environment

  • OpenClaw version: 2026.4.5 (broken) / 2026.4.2 (working)
  • Node.js: v25.9.0
  • OS: macOS (Apple Silicon)
  • Proxy: HTTP proxy configured via channels.discord.proxy + proxy-preload.cjs (--require injected in LaunchAgent plist)

Description

After upgrading from 2026.4.2 to 2026.4.5, all Discord REST deliveries start failing:

  1. Agent replies disappear — streaming/partial content shows briefly, then the final reply edit fails and the message vanishes from Discord.
  2. Slash commands hang/status, /new, /reset never return a response. Discord shows "application did not respond."

The root cause is the undici ^7.24.6 → ^8.0.1 major version bump between these two releases.

Error logs

Content-Type header rejected by Discord API (42 occurrences in one day):

[discord] final reply failed: Error: {"_misc": ["Expected \"Content-Type\" header to be one of
  {'application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'}."]}
    at ProxyRequestClientCompat.executeRequest (…/dist/send-DezGS_D4.js:567:27)
    at ProxyRequestClientCompat.processQueue (…/dist/send-DezGS_D4.js:578:21)

Slash commands — double acknowledgment + timeout:

DiscordError: Interaction has already been acknowledged.
  status: 400, discordCode: 40060

[EventQueue] Slow listener detected: InteractionEventListener took 37037ms for event INTERACTION_CREATE

[discord] slash final reply failed: Error: {"_misc": ["Expected \"Content-Type\" header …"]}

All errors started on the same day as the 4.5 upgrade. Before the upgrade, the only Discord delivery failures were TypeError: fetch failed (network-level), never Content-Type validation errors.

Root cause analysis

The behavioral difference between undici v7 and v8 is visible in the proxy-preload.cjs startup log:

Versionundiciproxy-preload log
2026.4.2^7.24.6EnvHttpProxyAgent active, proxy=http://127.0.0.1:…
2026.4.5^8.0.1EnvHttpProxyAgent active, proxy=http://127.0.0.1:… **(dispatcher locked)**

In undici v8, EnvHttpProxyAgent locks the global dispatcher. This interferes with ProxyRequestClientCompat.executeRequest() in send-DezGS_D4.js, which constructs a Headers object, sets Content-Type: application/json (line 530), and calls fetch() with the headers. When the global dispatcher is locked, the Content-Type header is dropped or not forwarded to the Discord API.

Verification steps performed:

  1. Proxy itself is not the issuecurl --proxy <proxy> -X PATCH -H "Content-Type: application/json" -d '{}' https://discord.com/api/v10/channels/0/messages/0 returns HTTP 401 (expected), not Content-Type error.
  2. undici ProxyAgent works in isolation — Direct test with OpenClaw's bundled undici v8 ProxyAgent + explicit Content-Type header through the same proxy returns HTTP 401 correctly. The issue only manifests when EnvHttpProxyAgent has locked the global dispatcher.
  3. Downgrade confirms — Reverting to 2026.4.2 (undici v7) immediately eliminates all Content-Type errors and restores normal Discord message delivery and slash command handling.

How to reproduce

  1. Configure an HTTP proxy (e.g., Clash, V2Ray) on 127.0.0.1:<port>
  2. Inject proxy-preload.cjs via --require in the gateway launch args (or set HTTP_PROXY/HTTPS_PROXY env vars)
  3. Configure a Discord channel with channels.discord.proxy pointing to the same proxy
  4. Start the gateway on version 2026.4.5
  5. Send a message in Discord → agent streams a partial reply, then the final reply disappears
  6. Run any slash command (/status, /new, /reset) → command hangs indefinitely

Expected: Messages delivered, slash commands respond. Actual: Final reply fails with Content-Type error; slash commands timeout.

Workaround

Downgrade to 2026.4.2:

npm install -g [email protected]

The only config incompatibility is plugins.entries.memory-core.config.dreaming (added in 4.5, not recognized by 4.2) — remove it or set the entry to {}.

Additional context

This is likely the same underlying undici v8 regression as:

  • #61448 — per-request dispatcher incompatible with built-in fetch
  • #61937 — FormData drops fields when dispatcher is present
  • #62181 — globalThis.fetch does not honor proxy env vars

The Discord REST path is particularly affected because:

  • proxy-preload.cjs sets up a global EnvHttpProxyAgent (locks dispatcher in v8)
  • The Discord channel config also creates a per-channel ProxyAgent via makeProxyFetch()
  • ProxyRequestClientCompat uses this.customFetch ?? globalThis.fetch — when the global dispatcher is locked, the per-request headers constructed in executeRequest() are not properly forwarded

A potential fix could be to either:

  1. Pin undici to v7 until the dispatcher-locking behavior is resolved upstream in undici
  2. Avoid using EnvHttpProxyAgent in proxy-preload and instead use per-request ProxyAgent without global dispatcher locking
  3. Ensure ProxyRequestClientCompat explicitly passes headers in a way that survives dispatcher locking

extent analysis

TL;DR

Downgrade to OpenClaw version 2026.4.2 to avoid the undici v8 regression that causes Discord REST delivery failures.

Guidance

  • Verify that the issue is resolved by downgrading to 2026.4.2 and checking for Discord message delivery and slash command functionality.
  • If downgrading is not feasible, consider pinning undici to v7 until the dispatcher-locking behavior is resolved upstream.
  • To mitigate the issue, avoid using EnvHttpProxyAgent in proxy-preload.cjs and instead use per-request ProxyAgent without global dispatcher locking.
  • Review the ProxyRequestClientCompat implementation to ensure that headers are explicitly passed in a way that survives dispatcher locking.

Example

npm install -g [email protected]

Remove or set plugins.entries.memory-core.config.dreaming to {} to avoid config incompatibility.

Notes

The undici v8 regression is a known issue, and downgrading to v7 or avoiding EnvHttpProxyAgent may be necessary until the issue is resolved upstream. The provided workaround has been verified to resolve the issue.

Recommendation

Apply the workaround by downgrading to OpenClaw version 2026.4.2, as it is a verified solution to the issue. This will ensure that Discord message delivery and slash command functionality are restored until a permanent fix is available.

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