continuedev/continue · error · Error
Failed to embed chunk: ${await resp.text()}
Error message
Failed to embed chunk: ${await resp.text()} What it means
Thrown by Ollama._embed when POST /api/embed responds non-OK; the response body is appended to a 'Failed to embed chunk' prefix. Causes mirror other Ollama inline errors: missing model, JSON body rejected by the server version, or load failure.
Source
Thrown at core/llm/llms/Ollama.ts:748
protected async _embed(chunks: string[]): 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("api/embed", this.apiBase), {
method: "POST",
body: JSON.stringify({
model: this.model,
input: chunks,
}),
headers: headers,
});
if (!resp.ok) {
throw new Error(`Failed to embed chunk: ${await resp.text()}`);
}
const data = await resp.json();
const embedding: number[][] = data.embeddings;
if (!embedding || embedding.length === 0) {
throw new Error("Ollama generated empty embedding");
}
return embedding;
}
public async installModel(
modelName: string,
signal: AbortSignal,
progressReporter?: (task: string, increment: number, total: number) => void,
): Promise<any> {
const modelInfo = await getRemoteModelInfo(modelName, signal);
if (!modelInfo) {View on GitHub (pinned to 5522c6f44c)
Solutions
- Pull the embedding model: ollama pull nomic-embed-text
- Upgrade Ollama to >=0.1.27 where /api/embed exists
- Read the appended body text for the exact server-side reason
Example fix
# before (no embedding model pulled) # after ollama pull nomic-embed-text
Defensive patterns
Strategy: validation
Validate before calling
const installed = await Ollama.listModels(); if (!installed.includes(embedModel)) await Ollama.installModel(embedModel, signal);
Type guard
function isOllamaEmbedHttpError(e: unknown): boolean { return e instanceof Error && e.message.startsWith('Failed to embed chunk'); } Try / catch
try { await llm.embed(chunks); }
catch (e) { if (isOllamaEmbedHttpError(e)) logServerError(e.message.split(': ').pop()); else throw e; } Prevention
- Pull the embedding model before indexing
- Keep Ollama updated so /api/embed is supported
When it happens
Trigger: Indexing the codebase (@codebase) with Ollama as embed provider while the embedding model isn't pulled or the server rejects the /api/embed payload (older Ollama used /api/embeddings).
Common situations: Configuring an embedding model like nomic-embed-text without pulling it, or running an outdated Ollama that doesn't have /api/embed.
Related errors
- HTTP ${e.response.status} ${e.response.statusText} from ${e.
- await resp.text()
- await resp.text()
- await resp.text()
- j.error
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/45a4a6d45f5084cd.
Report an issue: GitHub.