continuedev/continue · error · Error

Failed to list Ollama models. Make sure Ollama is running.

Error message

Failed to list Ollama models. Make sure Ollama is running.

What it means

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.

Source

Thrown at core/llm/llms/Ollama.ts:724

      "Content-Type": "application/json",
    };

    if (this.apiKey) {
      headers.Authorization = `Bearer ${this.apiKey}`;
    }
    const response = await this.fetch(
      // localhost was causing fetch failed in pkg binary only for this Ollama endpoint
      this.getEndpoint("api/tags"),
      {
        method: "GET",
        headers: headers,
      },
    );
    const data = await response.json();
    if (response.ok) {
      return data.models.map((model: any) => model.name);
    } else {
      throw new Error(
        "Failed to list Ollama models. Make sure Ollama is running.",
      );
    }
  }

  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,

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Run `ollama serve` (or start the app) and confirm `curl http://localhost:11434/api/tags` returns JSON
  2. Check the configured Ollama host/port in config.json matches where Ollama listens
  3. Upgrade Ollama if /api/tags is missing or errors

Example fix

# before
$ curl http://localhost:11434/api/tags
curl: (7) Failed to connect
# after
$ ollama serve &
$ curl http://localhost:11434/api/tags
{"models":[...]}
Defensive patterns

Strategy: validation

Validate before calling

async function ollamaUp(host = 'http://localhost:11434'): Promise<boolean> {
  try { return (await fetch(`${host}/api/tags`)).ok; } catch { return false; }
}

Type guard

function isOllamaUnavailable(e: unknown): boolean { return e instanceof Error && e.message.includes('Failed to list Ollama models'); }

Try / catch

try { models = await Ollama.listModels(); }
catch (e) { if (isOllamaUnavailable(e)) models = []; else throw e; }

Prevention

When it happens

Trigger: Opening the model picker (which calls listModels) while Ollama is starting up, crashed, or the port serves a different service returning non-200.

Common situations: Ollama not started (ollama serve), still booting, bound to a different host/port than configured, or an old version without /api/tags.

Related errors


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