openclaw - 💡(How to fix) Fix [Bug] Text + MEDIA: sends as two separate Discord messages (text first, attachment second)

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…

When an assistant response contains both text content and a MEDIA: attachment, OpenClaw sends them as two separate Discord messages instead of one combined message. This creates a confusing "doubled" appearance where the text appears in one message and the file attachment in the next.

Root Cause

In block-reply-pipeline-DEYxmc4h.js, the createBlockReplyCoalescer function handles media payloads explicitly:

if (hasMedia) {
    flush({ force: true });  // ← flushes ANY buffered text FIRST as separate message
    onFlush(payload);         // ← then sends media as SEPARATE message
    return;
}

When a MEDIA payload arrives, the coalescer:

  1. Flushes any buffered text as one Discord message
  2. Sends the media payload as a second Discord message

Discord's API supports sending 1 file + caption text in a single API call (/channels/{id}/messages with files[] + content). The coalescer should merge the buffered text into the media payload's content field instead of flushing it separately.

Fix Action

Workaround

Keeping text before MEDIA: extremely minimal (e.g., just a few characters) reduces the visual impact, but the structural split still happens.

Code Example

if (hasMedia) {
    flush({ force: true });  // ← flushes ANY buffered text FIRST as separate message
    onFlush(payload);         // ← then sends media as SEPARATE message
    return;
}
RAW_BUFFERClick to expand / collapse

Description

When an assistant response contains both text content and a MEDIA: attachment, OpenClaw sends them as two separate Discord messages instead of one combined message. This creates a confusing "doubled" appearance where the text appears in one message and the file attachment in the next.

Root Cause

In block-reply-pipeline-DEYxmc4h.js, the createBlockReplyCoalescer function handles media payloads explicitly:

if (hasMedia) {
    flush({ force: true });  // ← flushes ANY buffered text FIRST as separate message
    onFlush(payload);         // ← then sends media as SEPARATE message
    return;
}

When a MEDIA payload arrives, the coalescer:

  1. Flushes any buffered text as one Discord message
  2. Sends the media payload as a second Discord message

Discord's API supports sending 1 file + caption text in a single API call (/channels/{id}/messages with files[] + content). The coalescer should merge the buffered text into the media payload's content field instead of flushing it separately.

Expected Behavior

Text + MEDIA: in the same assistant turn should arrive as one Discord message with the text as the message content and the file attached.

Workaround

Keeping text before MEDIA: extremely minimal (e.g., just a few characters) reduces the visual impact, but the structural split still happens.

Impact

Every assistant response that includes both text and a file attachment gets doubled on Discord. This is a recurring user pain point that cannot be fixed from prompts or configuration alone.

Environment

  • OpenClaw 2026.5.7 (eeef486)
  • Channel: Discord
  • Platform: macOS (arm64)

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