-
Notifications
You must be signed in to change notification settings - Fork 316
Telegram image replies fail with LocalMediaAccessError after image generation/edit failure; OpenAI multi-reference image edit also breaks with duplicate image parameter #345
Description
Here is a GitHub issue version you can paste as-is.
Title
Telegram image replies fail with LocalMediaAccessError after image generation/edit failure; OpenAI multi-reference image edit also breaks with duplicate image parameter
Body
Summary
When using OpenClaw via Telegram for thumbnail generation/editing, image-related requests often end with:
No response generated. Please try again.
From logs, this appears to be a combination of two bugs:
- OpenAI image edit fails when multiple reference images are passed
- Telegram then attempts to send a local image file that does not exist
- The user only sees the generic fallback message instead of a useful error
This makes Telegram-based image editing/generation unreliable, especially for “revise this thumbnail using reference sample(s)” workflows.
Observed behavior
Typical user flow:
- Ask OpenClaw on Telegram to generate a thumbnail
- First generation may succeed
- Then send a correction request with one or more sample/reference images
- OpenClaw retries several times
- Final user-visible response becomes:
No response generated. Please try again.
Key log evidence
1. Telegram tries to send a local media file that does not exist
telegram block reply failed: LocalMediaAccessError: Local media file not found: /Users/.../xxx.png
telegram final reply failed: LocalMediaAccessError: Local media file not found: /Users/.../xxx.png
Examples from logs:
telegram final reply failed: LocalMediaAccessError: Local media file not found: /Users/iidatetsunari/.openclaw/workspace/.openclaw/media/generated/renewable-energy-future-thumbnail.png
telegram final reply failed: LocalMediaAccessError: Local media file not found: /Users/iidatetsunari/.openclaw/workspace/managed_media/hormuz-crisis-extra-8-thumbnail-v4.png
telegram final reply failed: LocalMediaAccessError: Local media file not found: /Users/iidatetsunari/.openclaw/workspace/energy-banner-variant.png
2. OpenAI image edit fails when multiple reference images are passed
error [tools] image_generate failed: OpenAI image edit failed (HTTP 400): {
"error": {
"message": "Duplicate parameter: 'image'. You provided multiple values for this parameter, whereas only one is allowed. If you are trying to provide a list of values, use the array syntax instead e.g. 'image[]=<value>'.",
"type": "invalid_request_error",
"param": "image",
"code": "duplicate_parameter"
}
}
Relevant raw params show two input images:
{
"model": "openai/gpt-image-1",
"images": [
"/Users/.../file_8---575d8259-5450-4202-bf82-45bc493a2ec9.jpg",
"/Users/.../file_7---6a12d018-f85d-4531-a14a-60334b9b2880.jpg"
],
"size": "1536x1024",
"filename": "hormuz-crisis-extra-8-thumbnail-v4.png",
"count": 1,
"prompt": "Create a new Japanese newsletter thumbnail by closely matching the provided sample images..."
}This strongly suggests the OpenAI image edit adapter is not handling multi-image input correctly.
3. Provider-side temporary failures also happen, but are not handled gracefully
error [tools] image_generate failed: OpenAI image edit failed (HTTP 503): upstream connect error or disconnect/reset before headers. reset reason: connection termination
Even in this case, Telegram still later attempts to send a non-existent local file.
What seems to be happening
Current flow appears to be:
image_generatefails or does not produce the expected output file- Telegram reply construction still assumes the output image exists
- Telegram tries to attach/send that file
- Channel delivery fails with
LocalMediaAccessError - User only sees generic fallback:
No response generated. Please try again.
So this is not just a provider failure. It is also a channel/media delivery bug and an error-handling/fallback bug.
Expected behavior
If image generation/editing fails:
-
OpenClaw should not attempt to send a missing local image file
-
Telegram should fall back to a text explanation
-
User should see a meaningful error, for example:
- “Image edit failed because multiple reference images are not currently supported for this provider.”
- “Image generation service returned a temporary upstream error. Please retry.”
- “Generated image file was not found, so media could not be delivered.”
If multiple reference images are unsupported for OpenAI image edit:
- Either reject early with a user-visible error
- Or degrade to a single primary reference image
- But do not continue into a broken send path
Suspected root causes
A. Missing file existence check before Telegram media send
The Telegram channel adapter appears to attempt media send without verifying that the output file actually exists.
B. image_generate failure and channel fallback are not cleanly separated
A tool failure should degrade into a text response, not a second failure in media delivery.
C. OpenAI image edit multi-image input handling is broken
Passing multiple images appears to produce malformed request semantics (Duplicate parameter: 'image').
Proposed fixes
1. Add file existence checks before Telegram media send
Before sending local media, verify the file exists.
Pseudo-code:
if (!exists(mediaPath)) {
log.error("local media missing", { mediaPath })
sendTextFallback("Image generation failed and no output file was produced.")
return
}This would prevent LocalMediaAccessError from becoming the user-facing outcome.
2. Only construct media reply blocks from verified output files
Do not build Telegram media payloads from an intended filename alone.
The image tool should return only actual, verified output artifacts.
Suggested result contract:
type ImageGenerateResult = {
ok: boolean
outputFiles?: Array<{
path: string
exists: boolean
mimeType?: string
}>
provider?: string
model?: string
errorCode?: string
errorMessage?: string
userMessage?: string
}Then the channel layer should skip any outputFiles where exists !== true.
3. Guard OpenAI image edit against multiple reference images
At minimum, if provider is OpenAI image edit and images.length > 1, either:
- hard fail with a user-visible message, or
- degrade to the first image only
Example:
if (provider === "openai" && images.length > 1) {
throw new UserVisibleError(
"OPENAI_IMAGE_EDIT_MULTI_INPUT_UNSUPPORTED",
"OpenAI image edit currently supports only one reference image in this flow."
)
}A softer fallback would be to keep only the first image and emit a warning.
4. Standardize tool-failure → text-fallback behavior
When image_generate fails, return a text explanation instead of letting the user fall through to No response generated.
Examples:
- HTTP 400 duplicate image parameter
→ “Multiple reference images are not supported in this OpenAI image-edit flow. Please retry with one image only.” - HTTP 503 upstream failure
→ “Temporary image generation upstream error. Please retry shortly.” - output file missing
→ “Image generation did not produce a deliverable file.”
5. Improve internal error taxonomy
It would help to distinguish at least:
IMAGE_PROVIDER_BAD_REQUESTIMAGE_PROVIDER_TEMPORARY_FAILUREOUTPUT_FILE_MISSINGCHANNEL_MEDIA_SEND_FAILURE
This would make both logs and user-visible behavior much clearer.
Repro conditions
This seems reproducible under conditions like:
- Telegram channel
openai/gpt-image-1- Image edit or revision request
- One or more reference/sample images attached
- More likely when multiple reference images are attached
- Output filename specified in the workflow
Observed outcomes:
- OpenAI edit fails with HTTP 400 (
Duplicate parameter: 'image') for multi-reference input - or upstream 503
- then Telegram attempts to send a missing local file
- user sees
No response generated. Please try again.
Impact
This breaks a common real workflow:
- initial thumbnail generation
- then revision using a prior sample image
- then further adjustment of text balance / background symbols / style consistency
At the moment, Telegram image editing appears unreliable enough that users may need to move image work to Control UI or local execution instead.
Environment
Observed on:
- OpenClaw
2026.4.2 - Telegram channel enabled and working for normal text replies
agents.defaults.imageGenerationModel.primary = openai/gpt-image-1
Telegram text replies succeed normally.
The failure is specific to image generation/editing delivery.
Suggested temporary workaround
Until fixed, likely safest guidance is:
- For Telegram image edit flows, use only one reference image
- Avoid repeated iterative edits in the same conversation
- Prefer Control UI/local execution for image revision workflows
- If image generation fails, do not attempt channel media delivery for missing files
If useful, I can also turn this into a shorter maintainer-friendly issue with only the minimum repro, logs, and expected behavior.