continuedev/continue · warning

Failed to fetch Ollama library: ${response.status}

Error message

Failed to fetch Ollama library: ${response.status}

What it means

Thrown by fetchOllamaModels when scraping https://ollama.com/library returns a non-OK HTTP status. The model-list page is fetched to enumerate available Ollama models; any non-200 response aborts with the status code in the message.

Source

Thrown at core/llm/fetchModels.ts:68

function getOllamaIcon(modelName: string): string {
  if (OLLAMA_ICON_MAP[modelName]) {
    return OLLAMA_ICON_MAP[modelName];
  }
  let bestMatch = "";
  for (const prefix of Object.keys(OLLAMA_ICON_MAP)) {
    if (modelName.startsWith(prefix) && prefix.length > bestMatch.length) {
      bestMatch = prefix;
    }
  }
  return bestMatch ? OLLAMA_ICON_MAP[bestMatch] : "ollama.png";
}

async function fetchOllamaModels(): Promise<FetchedModel[]> {
  try {
    const response = await fetch("https://ollama.com/library");
    if (!response.ok) {
      throw new Error(`Failed to fetch Ollama library: ${response.status}`);
    }

    const html = await response.text();
    const models: FetchedModel[] = [];
    const items = html.split("x-test-model class=");
    const seen = new Set<string>();

    for (let i = 1; i < items.length; i++) {
      const item = items[i];
      const nameMatch = item.match(/href="\/library\/([^"]+)"/);
      if (!nameMatch) continue;
      const name = nameMatch[1];
      if (seen.has(name)) continue;

      const capabilities: string[] = [];
      const capRegex = /x-test-capability[^>]*>([^<]+)</g;
      let capMatch;
      while ((capMatch = capRegex.exec(item)) !== null) {

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Retry after a short delay in case of transient 5xx/rate limiting
  2. Check network access: curl -I https://ollama.com/library from the same machine
  3. If the site changed, update the library or pin a known-good version; fall back to manually listing installed models via `ollama list` (local /api/tags)

Example fix

// before
const models = await fetchModels(); // throws: 403
// after
try {
  const models = await fetchModels();
} catch (e) {
  const models = (await fetch("http://localhost:11434/api/tags")).json().models.map(m => ({ name: m.name }));
}
Defensive patterns

Strategy: retry

Validate before calling

const ping = await fetch('https://ollama.com/library', { method: 'HEAD' }); if (!ping.ok) useLocalOllamaTagsInstead();

Try / catch

catch (e) { if (e.message.includes('Failed to fetch Ollama library')) { await backoff(); retry(); } else throw e; }

Prevention

When it happens

Trigger: The library page returns 403/404/5xx — site redesign breaking the scraper, rate limiting from frequent requests, or network middleboxes blocking ollama.com.

Common situations: Corporate proxies/firewalls blocking external sites; ollama.com changing its HTML or rejecting bot traffic; offline or restricted environments.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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