diegosouzapw/OmniRoute · error

Vision API returned empty or invalid response

Error message

Vision API returned empty or invalid response

What it means

Error "Vision API returned empty or invalid response" thrown in diegosouzapw/OmniRoute.

Source

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

    // JSON path — also unwrap the { _streamed, summary } diagnostics envelope
    // that some OmniRoute capture paths attach to provider responses.
    return unwrapVisionSummary(await response.json());
  } catch {
    // Not JSON — attempt SSE / envelope parsing from the raw text.
  }

  let rawText = "";
  try {
    if (typeof (response as Response & { text?: unknown }).text === "function") {
      rawText = await response.text();
    }
  } catch {
    rawText = "";
  }

  const parsed = parseSseVisionBody(rawText);
  if (parsed === null) {
    throw new Error("Vision API returned empty or invalid response");
  }
  return parsed;
}

/**
 * Extract the description text from an OpenAI-compatible vision response.
 * Falls back to `reasoning_content` then `reasoning` when `content` is empty —
 * reasoning models (e.g. xiaomi/mimo-v2.5, opencode/mimo-v2.5-free) can exhaust
 * `max_tokens` on chain-of-thought and return `content: null` with a complete
 * analysis in a reasoning field. opencode-routed gateways name that field
 * `reasoning` rather than `reasoning_content` (#6623 / #10809).
 */
function extractOpenAICompatibleContent(data: unknown): string {
  const record = data as {
    choices?: Array<{
      message?: { content?: unknown; reasoning_content?: unknown; reasoning?: unknown };
    }>;
    error?: { message?: string };

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/guardrails/visionBridgeHelpers.ts:606 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/6ec3cbe5ff04e5fa. Report an issue: GitHub.