Hmbown/CodeWhale · warning

HTTP

Error message

HTTP {}

What it means

During a live probe of a local Ollama server, fetch_text issues an HTTP GET to the catalog endpoint and requires a 2xx response. Any non-success status (404, 500, etc.) is surfaced as `HTTP <status>`. The caller (probe_live_local_ollama_catalog) treats failed probes as no live catalog and falls back.

Solutions

  1. Verify Ollama is running and serving on the expected port (curl http://localhost:11434/api/tags)
  2. Upgrade Ollama if /v1/models returns 404 (older versions lack the OpenAI-compat endpoint)
  3. Check for proxy environment variables (HTTP_PROXY) that might intercept localhost traffic
  4. Confirm the URL passed to the probe is the correct base address

Example fix

# before (wrong port)
OLLAMA_HOST=http://localhost:8080 codewhale ...
# after
OLLAMA_HOST=http://localhost:11434 codewhale ...
Defensive patterns

Strategy: fallback

Validate before calling

const res = await fetch(`${base}/api/tags`);
if (!res.ok) console.warn(`ollama probe got HTTP ${res.status}; catalog will be treated as unavailable`);

Try / catch

try {
  const catalog = await probeLiveLocalOllamaCatalog(base);
} catch (e) {
  if (/^HTTP \d+$/.test(String(e))) {
    // fall back to static/local model list; check server health
  }
}

Prevention

When it happens

Trigger: GET to /api/tags or /v1/models on the local Ollama base URL returning a non-success status — server not fully started, wrong port, endpoint absent in an older Ollama version, or a proxy returning 4xx/5xx.

Common situations: Ollama not running or still booting; misconfigured OLLAMA_HOST port; older Ollama lacking the OpenAI-compat /v1/models route; corporate proxy intercepting localhost requests.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/982061d0e0189e5f. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/local_ollama.rs:151

        ProviderCatalogDelta {
            provider: "ollama".into(),
            base_url_fingerprint: fingerprint,
            fetched_at,
            offerings,
        },
    );
}

async fn fetch_text(url: &str) -> anyhow::Result<String> {
    // The first-run probe can run before any provider client has installed
    // the rustls crypto provider; the shared builder installs it (the bare
    // `reqwest::Client::builder()` panics under `rustls-no-provider`).
    let client = crate::tls::reqwest_client_builder()
        .timeout(TAGS_PROBE_TIMEOUT)
        .build()?;
    let response = client.get(url).send().await?;
    if !response.status().is_success() {
        anyhow::bail!("HTTP {}", response.status());
    }
    Ok(response.text().await?)
}

/// Probe local Ollama for a live catalog. Prefers native `/api/tags`, falls
/// back to OpenAI-compat `/v1/models`. Returns `None` when nothing useful
/// answered — never invents a tag.
pub(crate) async fn probe_live_local_ollama_catalog(
    config: &Config,
) -> Option<LiveLocalOllamaCatalog> {
    let endpoint_v1 = ollama_v1_base_url(config);
    let origin = ollama_native_origin(&endpoint_v1);
    let tags_url = format!("{origin}/api/tags");

    let tags = match fetch_text(&tags_url).await {
        Ok(body) => match parse_ollama_tags_response(&body) {
            Ok(tags) if !tags.is_empty() => tags,
            Ok(_) => return None,

View on GitHub (pinned to 73e0f67d83)