diegosouzapw/OmniRoute · error
Vision API error
Error message
Vision API error: ${anthropicData.error.message || JSON.stringify(anthropicData.error)} What it means
Anthropic-specific error path in callVisionModelSingle: the response parsed successfully but its top-level `error` object is present, so the error message (or the JSON-serialized error object when message is absent) is re-thrown. The Anthropic vision endpoint reported an error inside the body even though the HTTP layer succeeded — model name, auth or request-shape problem at the provider.
Solutions
- Read the embedded Anthropic error message for the exact cause (quota, invalid model)
- Retry with backoff for overloaded errors
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/lib/guardrails/visionBridgeHelpers.ts:855 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/489a7b8f17d9a4c1.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/guardrails/visionBridgeHelpers.ts:855
clearTimeout(timeoutId);
if (!response.ok) {
const errorText = await response.text().catch(() => "Unknown error");
throw new Error(`Vision API error ${response.status}: ${errorText}`);
}
const data = await readVisionResponseBody(response);
if (isAnthropic) {
// Anthropic response format: { content: [{ type: "text", text: "..." }] }
const anthropicData = data as {
content?: Array<{ type?: string; text?: string }>;
error?: { message?: string };
};
if (anthropicData.error) {
throw new Error(
`Vision API error: ${anthropicData.error.message || JSON.stringify(anthropicData.error)}`
);
}
const textContent = anthropicData.content?.find((c) => c.type === "text");
const content = textContent?.text;
if (!content || typeof content !== "string") {
throw new Error("Vision API returned empty or invalid response");
}
return content.trim();
} else {
// OpenAI-compatible response format. Falls back to reasoning_content when
// content is null — reasoning models (e.g. xiaomi/mimo-v2.5) can exhaust
// max_tokens on chain-of-thought and return content: null with the full
// analysis in reasoning_content.
return extractOpenAICompatibleContent(data);
}View on GitHub (pinned to a179ffed5b)