diegosouzapw/OmniRoute · error · Error

${parsed.error}

Error message

${parsed.error}

What it means

Upstream error relay in readJsonlResponse: a parsed JSONL line from HuggingChat contained an error field, and its value (the interpolated parsed.error) is re-thrown verbatim. The message text comes entirely from the upstream payload — e.g. rate limit, model unavailable, or quota errors reported mid-stream by HuggingChat.

Solutions

  1. Inspect the relayed upstream text to classify it (429/quota/auth) and route through the appropriate cooldown or fallback
  2. Retry with backoff for transient upstream errors
  3. Sanitize the relayed message before returning it to clients (buildErrorBody) since its content is upstream-controlled
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at open-sse/executors/huggingchat/jsonlStream.ts:207 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at open-sse/executors/huggingchat/jsonlStream.ts:207

    while (true) {
      if (signal?.aborted) break;

      const { value, done } = await reader.read();
      if (done) break;

      buffer += decoder.decode(value, { stream: true });

      const lines = buffer.split("\n");
      buffer = lines.pop() || "";

      for (const line of lines) {
        const trimmed = line.trim();
        if (!trimmed) continue;

        const parsed = parseJsonlLine(trimmed);
        if (parsed.token) fullText += parsed.token;
        if (parsed.text) return parsed.text;
        if (parsed.error) throw new Error(parsed.error);
      }
    }

    if (buffer.trim()) {
      const parsed = parseJsonlLine(buffer.trim());
      if (parsed.text) return parsed.text;
      if (parsed.token) fullText += parsed.token;
    }
  } finally {
    reader.releaseLock();
  }

  return fullText;
}

View on GitHub (pinned to a179ffed5b)