{"record":{"id":"fd502b46e184f4c4","repo":"diegosouzapw/OmniRoute","slug":"parsed-error","errorCode":null,"errorMessage":"${parsed.error}","messagePattern":"\\$\\{parsed\\.error\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/huggingchat/jsonlStream.ts","lineNumber":207,"sourceCode":"    while (true) {\n      if (signal?.aborted) break;\n\n      const { value, done } = await reader.read();\n      if (done) break;\n\n      buffer += decoder.decode(value, { stream: true });\n\n      const lines = buffer.split(\"\\n\");\n      buffer = lines.pop() || \"\";\n\n      for (const line of lines) {\n        const trimmed = line.trim();\n        if (!trimmed) continue;\n\n        const parsed = parseJsonlLine(trimmed);\n        if (parsed.token) fullText += parsed.token;\n        if (parsed.text) return parsed.text;\n        if (parsed.error) throw new Error(parsed.error);\n      }\n    }\n\n    if (buffer.trim()) {\n      const parsed = parseJsonlLine(buffer.trim());\n      if (parsed.text) return parsed.text;\n      if (parsed.token) fullText += parsed.token;\n    }\n  } finally {\n    reader.releaseLock();\n  }\n\n  return fullText;\n}\n","sourceCodeStart":189,"sourceCodeEnd":222,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/huggingchat/jsonlStream.ts#L189-L222","documentation":"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.","triggerScenarios":"Thrown at open-sse/executors/huggingchat/jsonlStream.ts:207 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the relayed upstream text to classify it (429/quota/auth) and route through the appropriate cooldown or fallback","Retry with backoff for transient upstream errors","Sanitize the relayed message before returning it to clients (buildErrorBody) since its content is upstream-controlled"],"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"}