{"record":{"id":"287b0c5acd69acc0","repo":"diegosouzapw/OmniRoute","slug":"bifrost-sidecar-timed-out-after-config-timeoutms","errorCode":null,"errorMessage":"Bifrost sidecar timed out after ${config.timeoutMs}ms","messagePattern":"Bifrost sidecar timed out after (.+?)ms","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/app/api/v1/relay/chat/completions/route.ts","lineNumber":191,"sourceCode":"    recordUsage(\n      token.id,\n      request,\n      startTime,\n      clientIp,\n      userAgent,\n      // upstream.ok is guaranteed true here (the !upstream.ok branch above returns early).\n      \"success\",\n      upstream.status\n    );\n\n    return new Response(upstream.body, {\n      status: upstream.status,\n      headers,\n    });\n  } catch (error) {\n    clearTimeout(tid);\n    const isAbort = error instanceof Error && error.name === \"AbortError\";\n    throw new Error(\n      isAbort\n        ? `Bifrost sidecar timed out after ${config.timeoutMs}ms`\n        : `Bifrost sidecar unreachable: ${error instanceof Error ? error.message : String(error)}`\n    );\n  }\n}\n\nexport async function OPTIONS() {\n  return handleCorsOptions();\n}\n\nasync function postHandler(request: Request) {\n  const startTime = Date.now();\n  const clientIp = getClientIp(request);\n  const userAgent = sanitizeForensicHeader(request.headers.get(\"user-agent\"));\n\n  try {\n    // 1. Authenticate","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/api/v1/relay/chat/completions/route.ts#L173-L209","documentation":"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.","triggerScenarios":"Thrown at src/app/api/v1/relay/chat/completions/route.ts:191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Tune config.timeoutMs to the sidecar's real latency profile","Check sidecar health/startup if timeouts are constant","Fall back to the primary route when the sidecar is slow or down"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}