hermes - 💡(How to fix) Fix image_gen + video_gen: xAI ephemeral tmp URLs 404 by send_photo time — needs gateway-side caching

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…

image_generate tool returns xAI ephemeral tmp URLs (https://imgen.x.ai/xai-tmp-imgen-*.jpeg) that 404 by the time Telegram's send_photo fetches them. Three-tier delivery fallback (media_group → URL send_photo → file-upload send_photo) all fail with 404 Not Found. Same pattern likely affects video_gen for URLs that ARE persistent (vidgen.x.ai/xai-vidgen-bucket/) but where the LLM emits markdown ![alt](url) instead of using a media-routing API shape.

Error Message

ERROR [Telegram] File upload send_photo also failed: Client error '404 Not Found' for url 'https://imgen.x.ai/xai-tmp-imgen-*.jpeg'

Root Cause

Without the cache, every image_gen on a Telegram-routed profile delivers no image — only the text fallback. Functionally indistinguishable from a complete failure to end users. The TTS path works precisely because of the audio_cache step; the symmetric step is missing for image_gen.

Fix Action

Fix / Workaround

Discovered while running a Pass B migration battery (xAI provider switch + tool enablement). Detailed evidence + workaround in our migration log if useful for repro / triage.

Code Example

tool image_generate completed (5.60s, 556 chars)
   [Telegram] Sending media group of 1 photo(s) (chunk 1/1)
   [Telegram] Sending image: https://imgen.x.ai/.../xai-tmp-imgen-29c86b54-9557-4bb8-95df-ef8a3fc2fa05.jpeg (alt=Frühlingsmorgen im Garten)
   WARNING [Telegram] send_media_group failed (chunk 1/1), falling back to per-image: ... "webpage_curl_failed"
   WARNING [Telegram] URL-based send_photo failed, trying file upload: Wrong type of the web page content
   ERROR [Telegram] File upload send_photo also failed: Client error '404 Not Found' for url 'https://imgen.x.ai/xai-tmp-imgen-*.jpeg'
RAW_BUFFERClick to expand / collapse

Summary

image_generate tool returns xAI ephemeral tmp URLs (https://imgen.x.ai/xai-tmp-imgen-*.jpeg) that 404 by the time Telegram's send_photo fetches them. Three-tier delivery fallback (media_group → URL send_photo → file-upload send_photo) all fail with 404 Not Found. Same pattern likely affects video_gen for URLs that ARE persistent (vidgen.x.ai/xai-vidgen-bucket/) but where the LLM emits markdown ![alt](url) instead of using a media-routing API shape.

Reproduction

  1. Profile on xai-oauth provider + grok-4.3 model with image_gen.provider: xai config.
  2. Send via Telegram: "Mach mir ein Bild von einem Frühlingsmorgen im Garten."
  3. Gateway log shows:
    tool image_generate completed (5.60s, 556 chars)
    [Telegram] Sending media group of 1 photo(s) (chunk 1/1)
    [Telegram] Sending image: https://imgen.x.ai/.../xai-tmp-imgen-29c86b54-9557-4bb8-95df-ef8a3fc2fa05.jpeg (alt=Frühlingsmorgen im Garten)
    WARNING [Telegram] send_media_group failed (chunk 1/1), falling back to per-image: ... "webpage_curl_failed"
    WARNING [Telegram] URL-based send_photo failed, trying file upload: Wrong type of the web page content
    ERROR [Telegram] File upload send_photo also failed: Client error '404 Not Found' for url 'https://imgen.x.ai/xai-tmp-imgen-*.jpeg'

Proposed fix

Mirror the existing audio_cache pattern used for text_to_speech (which returns a local file_path like ~/.hermes/profiles/<p>/audio_cache/tts_*.ogg):

  • At image_generate tool-completion time, download the URL bytes synchronously.
  • Store at ~/.hermes/profiles/<p>/image_cache/imgen_<iso>.<ext> (chmod 600 for parity with audio cache).
  • Replace the URL in the tool result payload with the local path (file_path field) + optionally keep the original URL as source_url for traceability.
  • Telegram adapter then uses local-file upload path which already works (audio_cache voice bubbles work end-to-end).

For video_gen URLs that ARE persistent on vidgen.x.ai/xai-vidgen-bucket/, the issue is different: the LLM is emitting ![alt](url) markdown image syntax which Telegram doesn't render as video. A video_cache or just a normalized return shape with a clearer routing hint (e.g., explicit media_type: "video" field + delivery via send_video glue) would solve this.

Why this matters

Without the cache, every image_gen on a Telegram-routed profile delivers no image — only the text fallback. Functionally indistinguishable from a complete failure to end users. The TTS path works precisely because of the audio_cache step; the symmetric step is missing for image_gen.

Hermes version + commit

  • Hermes Agent v0.13.0 (2026.5.7)
  • Install commit 5f91b1a48b06c8260dc539614abda27cf4e831cb (post-hermes update to 374dc81c2359a6f61e8d1efc49de29d61d7b9a88)
  • Python 3.11.14, mcp 1.26.0, python-telegram-bot 22.7
  • Install-script-managed at ~/.hermes/hermes-agent/

Discovered while running a Pass B migration battery (xAI provider switch + tool enablement). Detailed evidence + workaround in our migration log if useful for repro / triage.

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

hermes - 💡(How to fix) Fix image_gen + video_gen: xAI ephemeral tmp URLs 404 by send_photo time — needs gateway-side caching