can1357/oh-my-pi · error · ToolError
Unable to resolve a model for inspect_image.
Error message
Unable to resolve a model for inspect_image.
What it means
inspect_image first tries to find a model whose declared input modalities include "image" (via roles @vision/@default, the active model, same-provider candidates, then any candidate). If no image-capable model exists at all but a text-only model can be resolved, it throws this error. The variant thrown here fires when not even a text-only model could be resolved from @vision, @default, or the active model pattern — i.e. the pattern strings match nothing in the registry.
Source
Thrown at packages/coding-agent/src/tools/inspect-image.ts:195
const activeModelPattern = this.session.getActiveModelString?.() ?? this.session.getModelString?.();
let model: Model<Api> | undefined;
let selectedPattern: string | undefined;
for (const pattern of ["@vision", "@default", activeModelPattern]) {
const resolved = resolvePattern(pattern);
if (resolved?.input.includes("image")) {
model = resolved;
selectedPattern = pattern;
break;
}
}
const activeProvider = resolvePattern(activeModelPattern)?.provider;
model ??= availableModels.find(
candidate => candidate.provider === activeProvider && candidate.input.includes("image"),
);
model ??= availableModels.find(candidate => candidate.input.includes("image"));
if (!model) {
const textOnly = resolvePattern("@vision") ?? resolvePattern("@default") ?? resolvePattern(activeModelPattern);
if (!textOnly) throw new ToolError("Unable to resolve a model for inspect_image.");
throw new ToolError(
`Resolved model ${textOnly.provider}/${textOnly.id} does not support image input. Configure a vision-capable model for modelRoles.vision.`,
);
}
const apiKey = await modelRegistry.getApiKey(model);
if (!apiKey) {
throw new ToolError(
`No API key available for ${model.provider}/${model.id}. Configure credentials for this provider or choose another vision-capable model.`,
);
}
let imageInput: LoadedImageInput | null;
const autoResize = this.session.settings.get("images.autoResize");
const excludeWebP = webpExclusionForModel(model);
const attachmentReference = parseImageAttachmentReference(params.path);
const imageTarget = attachmentReference
? undefinedView on GitHub (pinned to 9690622007)
Solutions
- Configure modelRoles.vision in settings to a registered, vision-capable model (e.g. provider/model-id).
- Verify the model ids in your config exactly match what the registry lists.
- Add/enable a vision-capable provider so getAvailable() includes an image-input model.
- Check for typos in role aliases (@vision/@default) and custom model filters.
Example fix
// before (settings)
{ "modelRoles": {} }
// after
{ "modelRoles": { "vision": "openai/gpt-4o" } } Defensive patterns
Strategy: validation
Validate before calling
const available = session.modelRegistry.getAvailable();
const visionRole = session.settings.get("modelRoles.vision");
const resolved = available.some(m =>
visionRole ? `${m.provider}/${m.id}` === String(visionRole).split(":")[0] : m.input.includes("image")
);
if (!resolved) {
// fix modelRoles.vision or register a vision model before calling inspect_image
} Try / catch
try {
await inspectImageTool.execute(id, params, signal);
} catch (e) {
if (e instanceof ToolError && e.message.includes("Unable to resolve a model")) {
// correct modelRoles.vision / active model configuration
} else throw e;
} Prevention
- Keep modelRoles.vision pointing at exact ids that exist in the registry.
- After changing model allowlists/filters, re-verify role resolution.
- Prefer resolving roles through the same resolver the tool uses (expandRoleAlias + resolveModelFromString) in pre-checks.
When it happens
Trigger: No available model has "image" in its input modalities AND resolvePattern fails for @vision, @default, and the active model string — e.g. role aliases unconfigured, the active model id not present in the registry, or the registry contents not matching config.
Common situations: Configured modelRoles.vision points to a model id that isn't registered; the active model was set to an id that failed discovery; a custom registry/allowlist filtered out every known model.
Related errors
- Model "${options.model}" not found
- resolved.error (model resolution failure)
- No models available. Use --model to select a model or config
- No models available in the bundled catalog
- Model "${options.model}" not found
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/dd38d1ddd55b1d22.
Report an issue: GitHub.