mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
2 lines
2.0 KiB
JSON
2 lines
2.0 KiB
JSON
{"author":{"id":"MDQ6VXNlcjE0NDAzMDM=","is_bot":false,"login":"matteoantoci","name":"Matteo Antoci"},"body":"## Enhancement: Propagate upstream error details to the client\n\n### Problem\n\nWhen an upstream provider returns an error, the client receives a generic message like:\n\n```\n[400]: Error from provider: Provider returned error\n```\n\nThe actual upstream error body is captured internally but never included in the response. This makes it difficult to debug issues — the real error (e.g., `context_length_exceeded`, `invalid_tool_call`, etc.) is hidden behind the generic wrapper.\n\n### Proposed behavior\n\nAdd an optional `upstream_details` field to error response bodies alongside the existing `error.message`/`type`/`code` structure. The existing error structure stays unchanged (OpenAI-compatible).\n\nExample response:\n\n```json\n{\n \"error\": {\n \"message\": \"[400]: Error from provider: Provider returned error\",\n \"type\": \"invalid_request_error\",\n \"code\": \"bad_request\"\n },\n \"upstream_details\": {\n \"error\": { \"message\": \"context_length_exceeded\", \"type\": \"invalid_request_error\" }\n }\n}\n```\n\n### Where this helps\n\n- Clients using providers that wrap errors in generic messages (e.g., opencode-go)\n- Debugging 400s from upstream providers where the real error is in the response body\n- Understanding why a specific request failed without checking server-side logs\n\n### Implementation notes\n\nThe upstream error body is already parsed and available in the error handling path. The change involves:\n1. Adding an optional parameter to error builder functions (`buildErrorBody`, `errorResponse`, `writeStreamError`, `createErrorResult`)\n2. Passing the parsed upstream body through at the relevant error sites","comments":[],"createdAt":"2026-04-28T10:04:16Z","labels":[],"number":1718,"title":"[Feature] expose upstream error details in client-facing error responses","url":"https://github.com/diegosouzapw/OmniRoute/issues/1718"}
|