{"record":{"id":"e47b655a073d3690","repo":"continuedev/continue","slug":"text","errorCode":null,"errorMessage":"text","messagePattern":"text","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/llm/llms/HuggingFaceTEI.ts","lineNumber":55,"sourceCode":"    const resp = await this.fetch(new URL(\"embed\", this.apiBase), {\n      method: \"POST\",\n      body: JSON.stringify({\n        inputs: batch,\n      }),\n      headers,\n    });\n    if (!resp.ok) {\n      const text = await resp.text();\n      let teiError: TEIEmbedErrorResponse | null = null;\n      try {\n        teiError = JSON.parse(text);\n      } catch (e) {\n        console.log(`Failed to parse TEI embed error response:\\n${text}`, e);\n      }\n      if (teiError && (teiError.error_type || teiError.error)) {\n        throw new TEIEmbedError(teiError);\n      }\n      throw new Error(text);\n    }\n    return (await resp.json()) as number[][];\n  }\n\n  async doInfoRequest(): Promise<TEIInfoResponse> {\n    // TODO - need to use custom fetch for this request?\n    const resp = await this.fetch(new URL(\"info\", this.apiBase), {\n      method: \"GET\",\n    });\n    if (!resp.ok) {\n      throw new Error(await resp.text());\n    }\n    return (await resp.json()) as TEIInfoResponse;\n  }\n\n  async rerank(query: string, chunks: Chunk[]): Promise<number[]> {\n    const headers: Record<string, string> = {\n      \"Content-Type\": \"application/json\",","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/HuggingFaceTEI.ts#L37-L73","documentation":"Fallback thrown by HuggingFaceTEI._embed when the TEI server returned a non-OK response whose body either failed to parse as JSON or had no recognizable error_type/error fields. The raw response text becomes the error message, which often means an HTML error page (502/504 from a proxy) or empty body.","triggerScenarios":"TEI endpoint returning non-JSON error bodies: gateway timeouts from a load balancer in front of the endpoint, 403/404 HTML pages from a wrong URL, or connection-level errors surfaced as plain text.","commonSituations":"apiBase pointing to a URL behind a proxy that returns HTML error pages, endpoint URL typo (404 page), or cloud endpoint hibernating.","solutions":["Read the raw text — if it looks like HTML, you're hitting a proxy/gateway or wrong URL; fix apiBase","If 502/504, the TEI server is down or cold-starting; retry after it's healthy","Confirm the endpoint returns JSON by curling it directly"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const probe = await fetch(`${apiBase}/info`);\nif (!probe.ok || !(probe.headers.get('content-type') ?? '').includes('json')) {\n  console.warn('TEI endpoint not serving JSON; check apiBase');\n}","typeGuard":"function isNonJsonServerError(e: unknown): boolean {\n  return e instanceof Error && /^\\s*<(!doctype|html)/i.test(e.message);\n}","tryCatchPattern":"try { await tei.embed(chunks); }\ncatch (e) { if (isNonJsonServerError(e)) fallbackToDefaultEmbedder(); else throw e; }","preventionTips":["Point apiBase directly at the TEI container, not a load-balancing proxy","Monitor TEI uptime during long indexing runs"],"tags":["huggingface","tei","embedding","gateway-error","non-json-response"],"backgroundTag":"embedding-server-error","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}