openclaw - 💡(How to fix) Fix [Bug]: Discord message.send silently drops attachments while returning success/message id [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#53641Fetched 2026-04-08 01:25:30
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2subscribed ×1

Discord outbound sends through OpenClaw are returning success and a valid messageId, but the attachment never uploads. The resulting Discord message has no attachments server-side.

Root Cause

There was an earlier hypothesis around mediaLocalRoots propagation, but that does not explain the observed behavior here because the issue persists after updating to 2026.3.23-2, and the file used for repro is workspace-rooted.

Code Example

For message `1485950046686937113`, Discord API returned:

json
{
"id": "1485950046686937113",
"content": "",
"attachments_count": 0,
"attachments": [],
"has_components": true
}

So this is not a Discord client rendering issue — the attachment never reached Discord.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

Discord outbound sends through OpenClaw are returning success and a valid messageId, but the attachment never uploads. The resulting Discord message has no attachments server-side.

Steps to reproduce

Used an existing workspace image:

/home/REDACTED/.openclaw/workspace/images/generated/test-gemini-post-update.jpg

Tested with Discord message.send using:

  • filePath
  • path
  • buffer

Expected behavior

Using the Discord message.send path with a local image or image buffer should create a Discord message with a populated attachments[] array and a visible uploaded file

Actual behavior

  • OpenClaw returns success
  • a Discord messageId is returned
  • the message appears in Discord without the file
  • querying the message via the Discord API shows:
  • attachments: []

OpenClaw version

2026.3.22, reproduced again after update to 2026.3.23-2

Operating system

Ubuntu

Install method

No response

Model

GPT 5.4

Provider / routing chain

openclaw -> GPT 5.4 via API

Additional provider/model setup details

No response

Logs, screenshots, and evidence

For message `1485950046686937113`, Discord API returned:

json
{
"id": "1485950046686937113",
"content": "",
"attachments_count": 0,
"attachments": [],
"has_components": true
}

So this is not a Discord client rendering issue — the attachment never reached Discord.

Impact and severity

No response

Additional information

This does not appear to be:

  • channel-specific
  • session-state-specific
  • image-generation-specific

It reproduces with a normal existing local image and ordinary Discord channel sends.

Current best hypothesis: the Discord send path is constructing the upload payload incorrectly for the Discord REST client.

Possibly:

  • files is being embedded inside the JSON body
  • instead of being passed as a top-level REST option alongside body

That would explain the current behavior:

  • message itself succeeds
  • Discord returns a message id
  • attachment portion is silently discarded

Likely somewhere around:

  • sendDiscordMedia
  • buildDiscordMessagePayload
  • serializePayload
  • rest.post(...) option shape

There was an earlier hypothesis around mediaLocalRoots propagation, but that does not explain the observed behavior here because the issue persists after updating to 2026.3.23-2, and the file used for repro is workspace-rooted.

extent analysis

Fix Plan

To resolve the issue of Discord outbound sends through OpenClaw failing to upload attachments, we need to modify the sendDiscordMedia function to correctly construct the upload payload for the Discord REST client.

Step-by-Step Solution:

  1. Modify the sendDiscordMedia function: Ensure that the files parameter is passed as a top-level option alongside the body in the REST request, rather than being embedded inside the JSON body.
  2. Update the buildDiscordMessagePayload function: Verify that this function correctly handles the files parameter and passes it to the rest.post method as intended.
  3. Adjust the serializePayload function: Confirm that this function does not interfere with the correct formatting of the files parameter.

Example Code Changes:

// Before
const payload = {
  body: JSON.stringify({
    content: message.content,
    files: files // Incorrectly embedding files inside the JSON body
  })
};

// After
const payload = {
  body: JSON.stringify({
    content: message.content
  }),
  files: files // Correctly passing files as a top-level option
};
// In the rest.post method
rest.post(url, {
  body: payload.body,
  files: payload.files // Ensure files are passed correctly
});

Verification

To verify that the fix worked, send a test message with an attachment using the updated sendDiscordMedia function and check the following:

  • The message appears in Discord with the attachment.
  • Querying the message via the Discord API returns a non-empty attachments array.

Extra Tips

  • Ensure that the files parameter is correctly formatted and passed to the rest.post method.
  • Verify that the Discord REST client is configured to accept file uploads.
  • Test the fix with different types of files and message contents to ensure it works 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

Using the Discord message.send path with a local image or image buffer should create a Discord message with a populated attachments[] array and a visible uploaded file

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 - 💡(How to fix) Fix [Bug]: Discord message.send silently drops attachments while returning success/message id [1 participants]