diegosouzapw/OmniRoute · error

Bifrost sidecar timed out after

Error message

Bifrost sidecar timed out after ${config.timeoutMs}ms

What it means

forwardToBifrost aborted: the AbortError raised when the sidecar exceeded config.timeoutMs is converted into this explicit message. The Bifrost sidecar did not respond within the configured budget, so the relay cannot serve the chat completion from it.

Solutions

  1. Tune config.timeoutMs to the sidecar's real latency profile
  2. Check sidecar health/startup if timeouts are constant
  3. Fall back to the primary route when the sidecar is slow or down
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/app/api/v1/relay/chat/completions/route.ts:191 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/287b0c5acd69acc0. Report an issue: GitHub.

Appendix: source

Thrown at src/app/api/v1/relay/chat/completions/route.ts:191

    recordUsage(
      token.id,
      request,
      startTime,
      clientIp,
      userAgent,
      // upstream.ok is guaranteed true here (the !upstream.ok branch above returns early).
      "success",
      upstream.status
    );

    return new Response(upstream.body, {
      status: upstream.status,
      headers,
    });
  } catch (error) {
    clearTimeout(tid);
    const isAbort = error instanceof Error && error.name === "AbortError";
    throw new Error(
      isAbort
        ? `Bifrost sidecar timed out after ${config.timeoutMs}ms`
        : `Bifrost sidecar unreachable: ${error instanceof Error ? error.message : String(error)}`
    );
  }
}

export async function OPTIONS() {
  return handleCorsOptions();
}

async function postHandler(request: Request) {
  const startTime = Date.now();
  const clientIp = getClientIp(request);
  const userAgent = sanitizeForensicHeader(request.headers.get("user-agent"));

  try {
    // 1. Authenticate

View on GitHub (pinned to a179ffed5b)