openclaw - 💡(How to fix) Fix image tool can't resolve telegram:file/ references for Telegram photos

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 a Telegram user sends a photo, the image tool (used by the LLM to inspect images) can't resolve telegram:file/<file_id> references. The media IS downloaded correctly to disk, but the internal URI scheme never gets resolved to a local path before the tool call.

Root Cause

In message-cache-BSVhrw8x.js, the mediaRef is set to telegram:file/${fileId}:

...fileId ? { mediaRef: `telegram:file/${fileId}` } : {},

Meanwhile, attachment-normalize-D55neHIL.js downloads and saves the file correctly, producing media://inbound/${savedMedia.id}:

const mediaRef = `media://inbound/${savedMedia.id}`;

But the telegram:file/... reference in the conversation context is never resolved to the corresponding media://inbound/... path (or local filesystem path). The two pipelines don't connect.

Fix Action

Workaround

Manually checking ls -lt media/inbound/ for the most recent file matching the message timestamp works, but is fragile and adds latency.

Code Example

...fileId ? { mediaRef: `telegram:file/${fileId}` } : {},

---

const mediaRef = `media://inbound/${savedMedia.id}`;
RAW_BUFFERClick to expand / collapse

Summary

When a Telegram user sends a photo, the image tool (used by the LLM to inspect images) can't resolve telegram:file/<file_id> references. The media IS downloaded correctly to disk, but the internal URI scheme never gets resolved to a local path before the tool call.

Reproduction

  1. User sends a photo via Telegram DM
  2. The photo gets downloaded & saved to media/inbound/<uuid>.jpg
  3. The LLM receives the reference as telegram:file/AgACAgQ... in the conversation context
  4. When the LLM tries to call the image tool with that reference, it fails — the tool only understands file paths, http(s)://, data:, and file:// URIs

Root cause

In message-cache-BSVhrw8x.js, the mediaRef is set to telegram:file/${fileId}:

...fileId ? { mediaRef: `telegram:file/${fileId}` } : {},

Meanwhile, attachment-normalize-D55neHIL.js downloads and saves the file correctly, producing media://inbound/${savedMedia.id}:

const mediaRef = `media://inbound/${savedMedia.id}`;

But the telegram:file/... reference in the conversation context is never resolved to the corresponding media://inbound/... path (or local filesystem path). The two pipelines don't connect.

Workaround

Manually checking ls -lt media/inbound/ for the most recent file matching the message timestamp works, but is fragile and adds latency.

Suggested fix

Resolve telegram:file/<file_id> → local filesystem path (or media://inbound/<id>) before the message context reaches the LLM. The file has already been downloaded at that point — the reference just needs to be updated.

Environment

  • OpenClaw v2026.5.18
  • Telegram channel plugin enabled
  • Headless Ubuntu 24.04 host

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

openclaw - 💡(How to fix) Fix image tool can't resolve telegram:file/ references for Telegram photos