diegosouzapw/OmniRoute · error

Vision API error

Error message

Vision API error ${response.status}: ${errorText}

What it means

The proxied vision-model call returned a non-OK HTTP status; this throw re-raises it with the upstream status code and response text interpolated. The failure originates in the external vision API (auth failure, quota, model unavailable), not in this code — the timeout was already cleared, so this is purely an upstream rejection.

Solutions

  1. On 429, respect Retry-After and retry or switch vision model
  2. On 401/403, fix the credential for the vision provider
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/lib/guardrails/visionBridgeHelpers.ts:842 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/21edf8d9f17e4ae3. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/guardrails/visionBridgeHelpers.ts:842

                  image_url: {
                    url: normalizedImageInput,
                    detail: "high",
                  },
                },
                { type: "text", text: config.prompt },
              ],
            },
          ],
          max_tokens: 300,
        }),
      });
    }

    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");

View on GitHub (pinned to a179ffed5b)