{"record":{"id":"6b201fad3ce019ee","repo":"can1357/oh-my-pi","slug":"editunsupportedprovider-image-generation-is-tex","errorCode":null,"errorMessage":"${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.","messagePattern":"(.+?) 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\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/image-gen.ts","lineNumber":1761,"sourceCode":"\t\t\t\t\tif (!(error instanceof ProviderHttpError) || requestSignal?.aborted) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\tfailures.push({ provider, error });\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!foundCredentials) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"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.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (failures.length === 0 && unsupportedAspectRatioProvider) {\n\t\t\t\tassertImageAspectRatioSupported(unsupportedAspectRatioProvider, params.aspect_ratio);\n\t\t\t}\n\n\t\t\tif (failures.length === 0 && editUnsupportedProvider) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`${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.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new AggregateError(\n\t\t\t\tfailures.map(failure => failure.error),\n\t\t\t\t`Image generation failed for all credentialed providers: ${failures.map(failure => failure.provider).join(\", \")}`,\n\t\t\t);\n\t\t});\n\t},\n};\n\nexport async function getImageGenTools(\n\t_modelRegistry?: ModelRegistry,\n\t_activeModel?: Model,\n): Promise<Array<CustomTool<typeof imageGenSchema, ImageGenToolDetails>>> {\n\treturn [imageGenTool];\n}","sourceCodeStart":1743,"sourceCodeEnd":1779,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/image-gen.ts#L1743-L1779","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nimage_gen({ prompt: \"remove background\", images: [\"attachment://1\"] }) // only deepinfra credentialed\n// after\nexport OPENAI_API_KEY=sk-...  // edit-capable provider\nimage_gen({ prompt: \"remove background\", images: [\"attachment://1\"] })","handlingStrategy":"validation","validationCode":"const EDIT_CAPABLE = new Set(['openai','openai-codex','antigravity','xai','openrouter','gemini']);\nif (images.length > 0 && !EDIT_CAPABLE.has(activeProvider)) {\n  throw new Error(`${activeProvider} cannot edit images; configure an edit-capable provider or drop input images`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await imageGen({ images, ...params });\n} catch (err) {\n  if (err instanceof Error && err.message.includes('text-to-image only')) {\n    // retry without images or switch to an edit-capable provider\n    return imageGen({ ...params, images: [] });\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["validation","capability","image-edit","provider-support"],"backgroundTag":"operation-not-supported","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}