openclaw - 💡(How to fix) Fix Bug: Images sent via MEDIA: directive are duplicated on Telegram [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#70248Fetched 2026-04-23 07:27:17
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Timeline (top)
closed ×1commented ×1

When an agent sends an image using the MEDIA:./path.png directive in a Telegram channel, the image arrives duplicated — the recipient sees the same image twice in the chat.

Root Cause

  1. Root cause hypothesis: The image attachment appears to be registered twice — once from the inline MEDIA: text parsing, and once from the tool result attachment flow (e.g., when the image is generated by a tool call). Both paths produce the same outbound file, resulting in a duplicate send.

Fix Action

Workaround

None found from the assistant side. The duplication happens in the OpenClaw core message dispatch, before the message reaches the Telegram API.

Code Example

MEDIA:./image.png
RAW_BUFFERClick to expand / collapse

Bug: Images sent via MEDIA: directive are duplicated on Telegram

Description

When an agent sends an image using the MEDIA:./path.png directive in a Telegram channel, the image arrives duplicated — the recipient sees the same image twice in the chat.

Steps to Reproduce

  1. Configure OpenClaw with a Telegram channel
  2. Have the agent generate or reference a local image
  3. Agent includes MEDIA:./image.png in its response
  4. Observe that the image appears twice in the Telegram chat

Expected Behavior

The image should appear once — a single photo attachment with the caption text.

Actual Behavior

Two identical photo attachments are sent to the Telegram chat for each MEDIA: line.

Environment

  • OpenClaw version: 2026.4.15
  • Channel: Telegram
  • OS: Ubuntu 24.04 LTS (Linux x64)
  • Model provider: Ollama (local)

Investigation

I traced the issue through the OpenClaw source code:

  1. parse-CwkQk8aD.jssplitMediaFromOutput() extracts MEDIA: lines from the assistant's text output and creates attachment entries.

  2. send-DlzbQJQs.jssplitTelegramCaption() handles caption length limits (≤1024 chars → caption on photo, >1024 → separate text message).

  3. The outbound media directory (~/.openclaw/media/outbound/) shows multiple identical JPG files created per MEDIA: line — e.g., two files with different timestamps but identical content.

  4. Root cause hypothesis: The image attachment appears to be registered twice — once from the inline MEDIA: text parsing, and once from the tool result attachment flow (e.g., when the image is generated by a tool call). Both paths produce the same outbound file, resulting in a duplicate send.

  5. Tested workaround: Sending only MEDIA: with no accompanying text still produces duplicates, confirming the issue is not related to caption splitting logic.

Minimal Reproduction

Agent response containing:

MEDIA:./image.png

Results in two identical photo messages in Telegram.

Workaround

None found from the assistant side. The duplication happens in the OpenClaw core message dispatch, before the message reaches the Telegram API.

extent analysis

TL;DR

The most likely fix involves modifying the OpenClaw core message dispatch to prevent duplicate registration of image attachments.

Guidance

  • Investigate the splitMediaFromOutput() function in parse-CwkQk8aD.js to ensure it does not create duplicate attachment entries for the same MEDIA: line.
  • Review the tool result attachment flow to determine why it is producing an additional outbound file for the same image, potentially leading to duplicate sends.
  • Consider adding a uniqueness check for attachment entries before sending them to the Telegram API to prevent duplicates.
  • Verify that the issue is not related to the splitTelegramCaption() function by testing with captions under 1024 characters.

Example

No code snippet is provided due to the complexity of the issue and the need for further investigation.

Notes

The root cause hypothesis suggests that the issue lies in the duplicate registration of image attachments. However, further investigation is needed to confirm this and identify the exact cause.

Recommendation

Apply a workaround by adding a uniqueness check for attachment entries before sending them to the Telegram API, as the root cause is likely related to the OpenClaw core message dispatch.

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