{"record":{"id":"e61b1786755363e4","repo":"diegosouzapw/OmniRoute","slug":"omniroute-upstream-status-errtext-e61b17","errorCode":null,"errorMessage":"OmniRoute ${upstream.status}: ${errText}","messagePattern":"OmniRoute (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mitm/handlers/claudeCode.ts","lineNumber":51,"sourceCode":"      // Claude (open-sse/executors/antigravity.ts::stripTrailingAntigravityAssistantTurn).\n      // Guard: never strip messages down to empty — an empty array is itself an invalid\n      // request, so at least one entry (even a lone trailing assistant turn) is always\n      // preserved.\n      if (Array.isArray(payload.messages) && payload.messages.length > 0) {\n        while (\n          payload.messages.length > 1 &&\n          payload.messages[payload.messages.length - 1]?.role === \"assistant\"\n        ) {\n          payload.messages.pop();\n        }\n      }\n\n      const upstreamStart = this.now();\n      const upstream = await this.fetchRouter(payload, \"/v1/messages\", 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":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/mitm/handlers/claudeCode.ts#L33-L69","documentation":"Error \"OmniRoute ${upstream.status}: ${errText}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/mitm/handlers/claudeCode.ts:51 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"}