{"record":{"id":"d16434f8ef6bb03e","repo":"continuedev/continue","slug":"failed-to-list-ollama-models-make-sure-ollama-is","errorCode":null,"errorMessage":"Failed to list Ollama models. Make sure Ollama is running.","messagePattern":"Failed to list Ollama models\\. Make sure Ollama is running\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/llm/llms/Ollama.ts","lineNumber":724,"sourceCode":"      \"Content-Type\": \"application/json\",\n    };\n\n    if (this.apiKey) {\n      headers.Authorization = `Bearer ${this.apiKey}`;\n    }\n    const response = await this.fetch(\n      // localhost was causing fetch failed in pkg binary only for this Ollama endpoint\n      this.getEndpoint(\"api/tags\"),\n      {\n        method: \"GET\",\n        headers: headers,\n      },\n    );\n    const data = await response.json();\n    if (response.ok) {\n      return data.models.map((model: any) => model.name);\n    } else {\n      throw new Error(\n        \"Failed to list Ollama models. Make sure Ollama is running.\",\n      );\n    }\n  }\n\n  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,","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/Ollama.ts#L706-L742","documentation":"Thrown by Ollama.listModels when GET /api/tags completes but response.ok is false — i.e. the server responded, but with an error status. The fixed message suggests the common cause: the Ollama daemon isn't reachable/healthy, though any non-OK status triggers it.","triggerScenarios":"Opening the model picker (which calls listModels) while Ollama is starting up, crashed, or the port serves a different service returning non-200.","commonSituations":"Ollama not started (ollama serve), still booting, bound to a different host/port than configured, or an old version without /api/tags.","solutions":["Run `ollama serve` (or start the app) and confirm `curl http://localhost:11434/api/tags` returns JSON","Check the configured Ollama host/port in config.json matches where Ollama listens","Upgrade Ollama if /api/tags is missing or errors"],"exampleFix":"# before\n$ curl http://localhost:11434/api/tags\ncurl: (7) Failed to connect\n# after\n$ ollama serve &\n$ curl http://localhost:11434/api/tags\n{\"models\":[...]}","handlingStrategy":"validation","validationCode":"async function ollamaUp(host = 'http://localhost:11434'): Promise<boolean> {\n  try { return (await fetch(`${host}/api/tags`)).ok; } catch { return false; }\n}","typeGuard":"function isOllamaUnavailable(e: unknown): boolean { return e instanceof Error && e.message.includes('Failed to list Ollama models'); }","tryCatchPattern":"try { models = await Ollama.listModels(); }\ncatch (e) { if (isOllamaUnavailable(e)) models = []; else throw e; }","preventionTips":["Start ollama serve before opening the editor","Health-check the daemon at extension startup and show a actionable banner"],"tags":["ollama","list-models","server-not-running","daemon"],"backgroundTag":"llm-server-unreachable","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}