{"record":{"id":"29104523dbb0e627","repo":"diegosouzapw/OmniRoute","slug":"omniroute-upstream-status-errtext-291045","errorCode":null,"errorMessage":"OmniRoute ${upstream.status}: ${errText}","messagePattern":"OmniRoute (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mitm/handlers/openCode.ts","lineNumber":33,"sourceCode":"  async intercept(\n    req: IncomingMessage,\n    res: ServerResponse,\n    body: Buffer,\n    mappedModel: string,\n  ): Promise<void> {\n    const startedAt = this.now();\n    const intercepted = await this.hookBufferStart(req, body, mappedModel);\n\n    try {\n      const payload = JSON.parse(body.toString());\n      payload.model = mappedModel;\n\n      const upstreamStart = this.now();\n      const upstream = await this.fetchRouter(payload, \"/v1/chat/completions\", req.headers);\n\n      if (!upstream.ok) {\n        const errText = await upstream.text().catch(() => \"\");\n        throw new Error(`OmniRoute ${upstream.status}: ${errText}`);\n      }\n\n      let collected = \"\";\n      await this.pipeSSE(upstream, res, (chunk) => {\n        collected += chunk.toString();\n      });\n\n      const total = this.now() - startedAt;\n      this.hookBufferUpdate(intercepted, {\n        status: upstream.status,\n        responseHeaders: Object.fromEntries(upstream.headers.entries()),\n        responseBody: collected,\n        responseSize: Buffer.byteLength(collected),\n        proxyLatencyMs: upstreamStart - startedAt,\n        upstreamLatencyMs: total - (upstreamStart - startedAt),\n      });\n    } catch (err) {\n      await this.hookBufferError(intercepted, err);","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/mitm/handlers/openCode.ts#L15-L51","documentation":"Error \"OmniRoute ${upstream.status}: ${errText}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/mitm/handlers/openCode.ts:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}