can1357/oh-my-pi · error · ToolError

inspect_image request failed.

Error message

inspect_image request failed.

What it means

The vision LLM call completed but its AssistantMessage reports stopReason "error"; the tool surfaces the provider's errorMessage when present, otherwise this generic fallback. It means the provider rejected or failed the one-shot request (auth failure at request time, invalid request shape, provider-side error, rate limit, model rejecting image input, etc.).

Source

Thrown at packages/coding-agent/src/tools/inspect-image.ts:317

						},
					],
				},
				{
					apiKey: modelRegistry.resolver(model, this.session.getSessionId?.() ?? undefined),
					signal: effectiveSignal,
					reasoning,
				},
				{ telemetry, oneshotKind: "inspect_image", completeImpl: this.completeImageRequest },
			);
		} catch (error) {
			if (error instanceof Error && (error.name === "AbortError" || error.name === "TimeoutError")) {
				if (timedOut()) throw new ToolError(formatTimeoutMessage());
			}
			throw error;
		}

		if (response.stopReason === "error") {
			throw new ToolError(response.errorMessage ?? "inspect_image request failed.");
		}
		if (response.stopReason === "aborted") {
			if (timedOut()) throw new ToolError(formatTimeoutMessage());
			throw new ToolError("inspect_image request aborted.");
		}

		const text = extractTextContent(response);
		if (!text) {
			throw new ToolError("inspect_image model returned no text output.");
		}

		return {
			content: [{ type: "text", text }],
			details: {
				model: `${model.provider}/${model.id}`,
				imagePath: imageInput.resolvedPath,
				mimeType: imageInput.mimeType,
				usage: response.usage,

View on GitHub (pinned to 9690622007)

Solutions

  1. Read the accompanying errorMessage for the provider-specific cause and fix accordingly (key, quota, model).
  2. Verify the API key is valid and has quota for the resolved provider/model.
  3. Retry after a pause if it's a rate limit or transient provider outage.
  4. Switch modelRoles.vision to a different vision-capable provider/model.
  5. Check provider status page if 5xx errors persist.

Example fix

// before: failing provider
{ "modelRoles": { "vision": "flaky-provider/vision-model" } }
// after: known-good provider
{ "modelRoles": { "vision": "openai/gpt-4o" } }
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify credentials before the call
const key = await session.modelRegistry.getApiKey(model);
if (!key) throw new Error("Authenticate provider before inspect_image");

Try / catch

try {
  await inspectImageTool.execute(id, params, signal);
} catch (e) {
  if (e instanceof ToolError && e.message.includes("request failed")) {
    // inspect provider errorMessage, back off/retry on 429/5xx, or switch vision model
  } else throw e;
}

Prevention

When it happens

Trigger: Provider returns an error response for the complete request: invalid/expired API key surfaced at request time, HTTP 4xx/5xx from the provider, model refusing image payloads despite declared modality, quota/rate-limit exhaustion, or malformed request (e.g. thinking budget mismatch).

Common situations: Expired key failing only at call time; provider outage; rate limits hit from heavy usage; provider rejecting WEBP for models that can't take it (when exclusion logic doesn't cover it); region/endpoint misconfiguration.

Related errors


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