can1357/oh-my-pi · error · ToolError

inspect_image model returned no text output.

Error message

inspect_image model returned no text output.

What it means

After the vision model responds without an error or abort stop reason, inspect_image extracts the text content from the assistant message. If the response contains no text parts (only thinking, tool calls, or nothing at all), the tool throws this ToolError because it has no answer to return. This is a defensive check against providers/models that return empty or non-text completions for image questions.

Source

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

			);
		} 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,
			},
		};
	}
}

export { inspectImageToolRenderer } from "./inspect-image-renderer";

View on GitHub (pinned to 9690622007)

Solutions

  1. Check the resolved vision model (modelRoles.vision) and switch to a model that reliably returns text answers for image inputs.
  2. Re-run the request — some models intermittently return empty completions.
  3. Lower or adjust the thinking-effort configuration if the model is spending its entire budget on reasoning without emitting text.
  4. Verify provider/model compatibility; if a provider update broke text output, pin a known-good model id.

Example fix

// before: vision role pointing at a thinking-only model that emits no text
"modelRoles": { "vision": "gemini-3-pro:high" }
// after: a model that answers in text for image questions
"modelRoles": { "vision": "claude-sonnet-4-5" }
Defensive patterns

Strategy: retry

Validate before calling

const visionModel = settings.get("modelRoles.vision");
if (!visionModel || /thinking-only|reasoning/.test(String(visionModel))) {
  console.warn("Vision model may not return text output; verify before inspect_image.");
}

Type guard

function hasTextContent(response: AssistantMessage): boolean {
  return Array.isArray(response.content) &&
    response.content.some(p => p.type === "text" && p.text.trim().length > 0);
}

Try / catch

try {
  const result = await inspectImage.execute(id, params, signal);
} catch (err) {
  if (err instanceof ToolError && err.message.includes("no text output")) {
    // retry once, then fall back to a different vision model
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Calling inspect_image with a model that returns a completion containing no text content — e.g. a thinking-only response, a model that emits tool_call content instead of text, or a misconfigured vision role pointing at a non-chat model.

Common situations: Configuring modelRoles.vision to a model that replies with reasoning-only or empty content; a provider API change that stops returning text parts; model returns only reasoning blocks after heavy thinking-effort configuration.

Related errors


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