continuedev/continue · error · Error

await resp.text()

Error message

await resp.text()

What it means

Thrown by HuggingFaceTEI.doInfoRequest (called from the constructor) when GET {apiBase}/info fails with a non-OK status. The /info endpoint is queried at provider construction to learn the server's capabilities, so this error fires early — typically at config load time, before any chat or embedding call.

Source

Thrown at core/llm/llms/HuggingFaceTEI.ts:66

        teiError = JSON.parse(text);
      } catch (e) {
        console.log(`Failed to parse TEI embed error response:\n${text}`, e);
      }
      if (teiError && (teiError.error_type || teiError.error)) {
        throw new TEIEmbedError(teiError);
      }
      throw new Error(text);
    }
    return (await resp.json()) as number[][];
  }

  async doInfoRequest(): Promise<TEIInfoResponse> {
    // TODO - need to use custom fetch for this request?
    const resp = await this.fetch(new URL("info", this.apiBase), {
      method: "GET",
    });
    if (!resp.ok) {
      throw new Error(await resp.text());
    }
    return (await resp.json()) as TEIInfoResponse;
  }

  async rerank(query: string, chunks: Chunk[]): Promise<number[]> {
    const headers: Record<string, string> = {
      "Content-Type": "application/json",
    };

    if (this.apiKey) {
      headers["Authorization"] = `Bearer ${this.apiKey}`;
    }

    const resp = await this.fetch(new URL("rerank", this.apiBase), {
      method: "POST",
      headers,
      body: JSON.stringify({
        query: query,

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. curl {apiBase}/info manually — expect JSON with model_id, max_client_batch_size, etc.; if not, fix the URL or server
  2. Ensure apiBase points at the TEI server root (e.g. http://localhost:8080) not another service
  3. If auth is required, configure headers or put the server on a trusted network

Example fix

// before
"apiBase": "http://localhost:11434" // Ollama port
// after
"apiBase": "http://localhost:8080"   // TEI port
Defensive patterns

Strategy: validation

Validate before calling

const r = await fetch(new URL('info', apiBase));
if (!r.ok) throw new Error(`TEI unreachable at ${apiBase} (status ${r.status})`);

Type guard

const isTEIServer = async (base: string) => {
  const r = await fetch(new URL('info', base));
  return r.ok && !!(await r.json()).model_id;
};

Try / catch

try { new HuggingFaceTEI(config); } catch (e) { if (e instanceof Error && e.message.includes('<')) fixApiBase(); else throw e; }

Prevention

When it happens

Trigger: Constructing the HuggingFaceTEI provider with an apiBase whose /info route returns non-2xx: wrong port, non-TEI server at that URL, or TEI requiring auth headers the request doesn't send.

Common situations: Pointing apiBase at a TGI/Ollama server instead of TEI, URL with a trailing path segment so /info resolves incorrectly, or firewall/auth blocking the GET.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/6984454cedc11573. Report an issue: GitHub.