can1357/oh-my-pi · error · Error
${editUnsupportedProvider} image generation is text-to-image
Error message
${editUnsupportedProvider} image generation is text-to-image only and cannot edit input images. Configure an edit-capable provider (openai, openai-codex, antigravity, xai, openrouter, gemini) or retry without input images. What it means
Some configured image providers are text-to-image only and cannot consume input images for editing. When the request includes input images but the only credentialed provider lacks edit support, the tool throws naming that provider and listing edit-capable alternatives (openai, openai-codex, antigravity, xai, openrouter, gemini).
Source
Thrown at packages/coding-agent/src/tools/image-gen.ts:1761
if (!(error instanceof ProviderHttpError) || requestSignal?.aborted) {
throw error;
}
failures.push({ provider, error });
}
}
if (!foundCredentials) {
throw new Error(
"No image API credentials found. Connect a Codex (ChatGPT) subscription, use a GPT Responses/Codex model with OpenAI credentials, log in with google-antigravity or xAI Grok OAuth, or set OPENAI_API_KEY, XAI_API_KEY, OPENROUTER_API_KEY, GEMINI_API_KEY, GOOGLE_API_KEY, or DEEPINFRA_API_KEY.",
);
}
if (failures.length === 0 && unsupportedAspectRatioProvider) {
assertImageAspectRatioSupported(unsupportedAspectRatioProvider, params.aspect_ratio);
}
if (failures.length === 0 && editUnsupportedProvider) {
throw new Error(
`${editUnsupportedProvider} image generation is text-to-image only and cannot edit input images. Configure an edit-capable provider (openai, openai-codex, antigravity, xai, openrouter, gemini) or retry without input images.`,
);
}
throw new AggregateError(
failures.map(failure => failure.error),
`Image generation failed for all credentialed providers: ${failures.map(failure => failure.provider).join(", ")}`,
);
});
},
};
export async function getImageGenTools(
_modelRegistry?: ModelRegistry,
_activeModel?: Model,
): Promise<Array<CustomTool<typeof imageGenSchema, ImageGenToolDetails>>> {
return [imageGenTool];
}View on GitHub (pinned to 9690622007)
Solutions
- Add credentials for an edit-capable provider listed in the message (e.g. export OPENAI_API_KEY or GEMINI_API_KEY).
- Retry without input images if pure text-to-image output is acceptable.
- Perform the edit with a different tool/workflow (e.g. local image editor) and use this provider only for generation.
- Verify which provider your config routes image-gen to before passing reference images.
Example fix
// before
image_gen({ prompt: "remove background", images: ["attachment://1"] }) // only deepinfra credentialed
// after
export OPENAI_API_KEY=sk-... // edit-capable provider
image_gen({ prompt: "remove background", images: ["attachment://1"] }) Defensive patterns
Strategy: validation
Validate before calling
const EDIT_CAPABLE = new Set(['openai','openai-codex','antigravity','xai','openrouter','gemini']);
if (images.length > 0 && !EDIT_CAPABLE.has(activeProvider)) {
throw new Error(`${activeProvider} cannot edit images; configure an edit-capable provider or drop input images`);
} Try / catch
try {
await imageGen({ images, ...params });
} catch (err) {
if (err instanceof Error && err.message.includes('text-to-image only')) {
// retry without images or switch to an edit-capable provider
return imageGen({ ...params, images: [] });
}
throw err;
} Prevention
- Track per-provider edit capability alongside credentials
- Only attach reference images when the routed provider supports edits
- Document provider capabilities in config so routing picks edit-capable ones for edit jobs
When it happens
Trigger: Calling image-gen in edit mode (resolvedImages.length > 0) where the sole credentialed provider is edit-unsupported, at image-gen.ts:1761. Only fires when that provider attempt produced no other failure (failures.length === 0).
Common situations: Only DEEPINFRA_API_KEY (or another text-to-image-only provider) configured while asking to modify an attached image; assuming every image model supports img2img; switching API keys without rechecking edit capability.
Related errors
- Aspect ratio ${aspectRatio} is only supported by xAI image g
- xAI image edits accept up to ${XAI_MAX_EDIT_IMAGES} referenc
- Unsupported language '{value}'. Supported: {}
- Unable to infer language from file extension: {}. Specify `l
- Invalid pattern: {err}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/6b201fad3ce019ee.
Report an issue: GitHub.