can1357/oh-my-pi · error · AggregateError

Image generation failed for all credentialed providers: ${fa

Error message

Image generation failed for all credentialed providers: ${failures.map(failure => failure.provider).join(", ")}

What it means

Final fallback after the tool attempted every credentialed image provider and each attempt failed. An AggregateError is thrown whose errors array holds each provider's underlying exception, with a message listing the providers that were tried. The individual causes must be inspected to know why each provider failed.

Source

Thrown at packages/coding-agent/src/tools/image-gen.ts:1766

			}

			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];
}

export async function getImageGenToolsWithRegistry(
	_modelRegistry: ModelRegistry,
	_activeModel?: Model,
): Promise<Array<CustomTool<typeof imageGenSchema, ImageGenToolDetails>>> {

View on GitHub (pinned to 9690622007)

Solutions

  1. Inspect aggregate.errors — each element corresponds to a provider listed in the message and carries its HTTP status/detail.
  2. Fix the underlying per-provider causes (keys, quotas, model ids) identified in the nested errors.
  3. Retry after backoff if the nested errors are 429/5xx (transient).
  4. Configure one healthy provider with a funded account and a known-good image model.
  5. Reduce request complexity (size, count) if providers reject the parameters.
Defensive patterns

Strategy: try-catch

Validate before calling

const credentialed = providers.filter(p => hasCredential(p));
if (credentialed.length === 0) failFast('no image credentials');
if (credentialed.every(p => !p.healthy)) warn('all credentialed image providers recently failing');

Try / catch

try {
  return await imageGen(params);
} catch (err) {
  if (err instanceof AggregateError) {
    for (const cause of err.errors) logProviderCause(cause); // per-provider status/detail
    if (err.errors.every(isTransient)) return retryWithBackoff(() => imageGen(params));
  }
  throw err;
}

Prevention

When it happens

Trigger: All credentialed providers attempted and rejected — e.g. OpenAI 401 + Gemini 429 + OpenRouter 402 in one run — reaching image-gen.ts:1766; only possible when at least one credential existed (otherwise 2515 fires).

Common situations: Multiple keys expired or revoked at once; shared egress IP rate-limited across providers; transient multi-provider outage; all keys lacking image-model access; free-tier quotas exhausted everywhere.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/1cb762348058b403. Report an issue: GitHub.