{"record":{"id":"f2a76f17a950f246","repo":"can1357/oh-my-pi","slug":"inspect-image-request-failed","errorCode":null,"errorMessage":"inspect_image request failed.","messagePattern":"inspect_image request failed\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/inspect-image.ts","lineNumber":317,"sourceCode":"\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tapiKey: modelRegistry.resolver(model, this.session.getSessionId?.() ?? undefined),\n\t\t\t\t\tsignal: effectiveSignal,\n\t\t\t\t\treasoning,\n\t\t\t\t},\n\t\t\t\t{ telemetry, oneshotKind: \"inspect_image\", completeImpl: this.completeImageRequest },\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error && (error.name === \"AbortError\" || error.name === \"TimeoutError\")) {\n\t\t\t\tif (timedOut()) throw new ToolError(formatTimeoutMessage());\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (response.stopReason === \"error\") {\n\t\t\tthrow new ToolError(response.errorMessage ?? \"inspect_image request failed.\");\n\t\t}\n\t\tif (response.stopReason === \"aborted\") {\n\t\t\tif (timedOut()) throw new ToolError(formatTimeoutMessage());\n\t\t\tthrow new ToolError(\"inspect_image request aborted.\");\n\t\t}\n\n\t\tconst text = extractTextContent(response);\n\t\tif (!text) {\n\t\t\tthrow new ToolError(\"inspect_image model returned no text output.\");\n\t\t}\n\n\t\treturn {\n\t\t\tcontent: [{ type: \"text\", text }],\n\t\t\tdetails: {\n\t\t\t\tmodel: `${model.provider}/${model.id}`,\n\t\t\t\timagePath: imageInput.resolvedPath,\n\t\t\t\tmimeType: imageInput.mimeType,\n\t\t\t\tusage: response.usage,","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/inspect-image.ts#L299-L335","documentation":"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.).","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the accompanying errorMessage for the provider-specific cause and fix accordingly (key, quota, model).","Verify the API key is valid and has quota for the resolved provider/model.","Retry after a pause if it's a rate limit or transient provider outage.","Switch modelRoles.vision to a different vision-capable provider/model.","Check provider status page if 5xx errors persist."],"exampleFix":"// before: failing provider\n{ \"modelRoles\": { \"vision\": \"flaky-provider/vision-model\" } }\n// after: known-good provider\n{ \"modelRoles\": { \"vision\": \"openai/gpt-4o\" } }","handlingStrategy":"try-catch","validationCode":"// Verify credentials before the call\nconst key = await session.modelRegistry.getApiKey(model);\nif (!key) throw new Error(\"Authenticate provider before inspect_image\");","typeGuard":null,"tryCatchPattern":"try {\n  await inspectImageTool.execute(id, params, signal);\n} catch (e) {\n  if (e instanceof ToolError && e.message.includes(\"request failed\")) {\n    // inspect provider errorMessage, back off/retry on 429/5xx, or switch vision model\n  } else throw e;\n}","preventionTips":["Keep provider credentials valid and monitor quota/rate limits.","Pin modelRoles.vision to a reliable provider and have a fallback model.","Handle transient provider errors with bounded backoff retries.","Watch provider status pages during incidents."],"tags":["llm-request","provider-error","network"],"backgroundTag":"llm-provider-request-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}