{"record":{"id":"3dc39877a25ce9af","repo":"can1357/oh-my-pi","slug":"no-models-available-for-inspect-image","errorCode":null,"errorMessage":"No models available for inspect_image.","messagePattern":"No models available for inspect_image\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/inspect-image.ts","lineNumber":167,"sourceCode":"\t\tparams: InspectImageParams,\n\t\tsignal?: AbortSignal,\n\t\t_onUpdate?: AgentToolUpdateCallback<InspectImageToolDetails>,\n\t\t_context?: AgentToolContext,\n\t): Promise<AgentToolResult<InspectImageToolDetails>> {\n\t\tif (this.session.settings.get(\"images.blockImages\")) {\n\t\t\tthrow new ToolError(\n\t\t\t\t\"Image submission is disabled by settings (images.blockImages=true). Disable it to use inspect_image.\",\n\t\t\t);\n\t\t}\n\n\t\tconst modelRegistry = this.session.modelRegistry;\n\t\tif (!modelRegistry) {\n\t\t\tthrow new ToolError(\"Model registry is unavailable for inspect_image.\");\n\t\t}\n\n\t\tconst availableModels = modelRegistry.getAvailable();\n\t\tif (availableModels.length === 0) {\n\t\t\tthrow new ToolError(\"No models available for inspect_image.\");\n\t\t}\n\n\t\tconst matchPreferences = getModelMatchPreferences(this.session.settings);\n\t\tconst resolvePattern = (pattern: string | undefined): Model<Api> | undefined => {\n\t\t\tif (!pattern) return undefined;\n\t\t\tconst expanded = expandRoleAlias(pattern, this.session.settings);\n\t\t\treturn resolveModelFromString(expanded, availableModels, matchPreferences);\n\t\t};\n\n\t\tconst activeModelPattern = this.session.getActiveModelString?.() ?? this.session.getModelString?.();\n\t\tlet model: Model<Api> | undefined;\n\t\tlet selectedPattern: string | undefined;\n\t\tfor (const pattern of [\"@vision\", \"@default\", activeModelPattern]) {\n\t\t\tconst resolved = resolvePattern(pattern);\n\t\t\tif (resolved?.input.includes(\"image\")) {\n\t\t\t\tmodel = resolved;\n\t\t\t\tselectedPattern = pattern;\n\t\t\t\tbreak;","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/inspect-image.ts#L149-L185","documentation":"The model registry exists but `getAvailable()` returned an empty list, so inspect_image has no candidate models to resolve a vision model from. The tool throws ToolError because image inspection fundamentally requires at least one LLM model to be configured and reachable.","triggerScenarios":"Calling inspect_image when no providers are authenticated/discovered: no API keys configured, all providers failed auth or discovery, or a filtered model list resolved to zero entries.","commonSituations":"Fresh install with no API keys in env/config; expired or revoked credentials causing discovery to yield nothing; running in an environment without provider configuration (CI, containers); models.json/provider discovery failing offline.","solutions":["Configure at least one provider's API key (env var like OPENAI_API_KEY/ANTHROPIC_API_KEY or the auth config).","Run `omp` models/auth setup to verify the registry lists models.","Check network access if provider discovery is failing.","Verify provider configuration files aren't empty or mispointed."],"exampleFix":"// before: no credentials\n// (env)\n// after\nexport ANTHROPIC_API_KEY=sk-ant-...\n# or add the key via the provider auth setup","handlingStrategy":"validation","validationCode":"const models = session.modelRegistry?.getAvailable() ?? [];\nif (models.length === 0) {\n  // prompt the user to configure a provider/API key before attempting image inspection\n}","typeGuard":null,"tryCatchPattern":"try {\n  await inspectImageTool.execute(id, params, signal);\n} catch (e) {\n  if (e instanceof ToolError && e.message.includes(\"No models available\")) {\n    // run provider setup / show onboarding message\n  } else throw e;\n}","preventionTips":["Configure at least one provider API key before using agent tools.","Validate on startup that the registry lists models (log a warning when empty).","In CI, ensure credentials are injected into the environment."],"tags":["configuration","models","api-key","setup"],"backgroundTag":"no-models-configured","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}