{"record":{"id":"45a4a6d45f5084cd","repo":"continuedev/continue","slug":"failed-to-embed-chunk-await-resp-text","errorCode":null,"errorMessage":"Failed to embed chunk: ${await resp.text()}","messagePattern":"Failed to embed chunk: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/llm/llms/Ollama.ts","lineNumber":748,"sourceCode":"  protected async _embed(chunks: string[]): Promise<number[][]> {\n    const headers: Record<string, string> = {\n      \"Content-Type\": \"application/json\",\n    };\n\n    if (this.apiKey) {\n      headers.Authorization = `Bearer ${this.apiKey}`;\n    }\n    const resp = await this.fetch(new URL(\"api/embed\", this.apiBase), {\n      method: \"POST\",\n      body: JSON.stringify({\n        model: this.model,\n        input: chunks,\n      }),\n      headers: headers,\n    });\n\n    if (!resp.ok) {\n      throw new Error(`Failed to embed chunk: ${await resp.text()}`);\n    }\n\n    const data = await resp.json();\n    const embedding: number[][] = data.embeddings;\n\n    if (!embedding || embedding.length === 0) {\n      throw new Error(\"Ollama generated empty embedding\");\n    }\n    return embedding;\n  }\n\n  public async installModel(\n    modelName: string,\n    signal: AbortSignal,\n    progressReporter?: (task: string, increment: number, total: number) => void,\n  ): Promise<any> {\n    const modelInfo = await getRemoteModelInfo(modelName, signal);\n    if (!modelInfo) {","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/Ollama.ts#L730-L766","documentation":"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.","triggerScenarios":"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).","commonSituations":"Configuring an embedding model like nomic-embed-text without pulling it, or running an outdated Ollama that doesn't have /api/embed.","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"],"exampleFix":"# before\n(no embedding model pulled)\n# after\nollama pull nomic-embed-text","handlingStrategy":"validation","validationCode":"const installed = await Ollama.listModels();\nif (!installed.includes(embedModel)) await Ollama.installModel(embedModel, signal);","typeGuard":"function isOllamaEmbedHttpError(e: unknown): boolean { return e instanceof Error && e.message.startsWith('Failed to embed chunk'); }","tryCatchPattern":"try { await llm.embed(chunks); }\ncatch (e) { if (isOllamaEmbedHttpError(e)) logServerError(e.message.split(': ').pop()); else throw e; }","preventionTips":["Pull the embedding model before indexing","Keep Ollama updated so /api/embed is supported"],"tags":["ollama","embedding","http-error","model-not-found"],"backgroundTag":"llm-provider-http-error","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}