continuedev/continue · error
Unable to connect to local Ollama instance. Ollama may not…
Error message
Unable to connect to local Ollama instance. Ollama may not be running.
What it means
Thrown in customFetch when a connection to http://127.0.0.1:11434 is refused and isOllamaInstalled() reports Ollama is installed. The message distinguishes 'installed but not running' from 'not installed', so this variant specifically means the binary/app exists but no server is listening on the default port.
Solutions
- Start the Ollama server: run `ollama serve` (or launch the desktop app)
- Verify it's listening: curl http://127.0.0.1:11434/api/tags
- If OLLAMA_HOST is customized, point the client's apiBase at that exact host:port
- Enable autostart (systemd user unit / login item) if this recurs after reboots
Example fix
# before
# ECONNREFUSED http://127.0.0.1:11434
# after
ollama serve &
curl http://127.0.0.1:11434/api/tags # 200 {"models":[...]} Defensive patterns
Strategy: retry
Validate before calling
const up = await fetch('http://127.0.0.1:11434/api/tags').then(r => r.ok).catch(() => false); if (!up) await spawn('ollama', ['serve']); Try / catch
catch (e) { if (e.message.includes('Unable to connect to local Ollama')) { await startOllamaAndWaitForPort(11434); retry(); } else throw e; } Prevention
- Autostart ollama serve (systemd/login item)
- Verify port matches OLLAMA_HOST
- Probe 127.0.0.1:11434 before first request
When it happens
Trigger: ECONNREFUSED to 127.0.0.1:11434 while Ollama is installed: the daemon isn't running, was stopped, or is bound to a different host/port (OLLAMA_HOST).
Common situations: Ollama desktop app quit or crashed; ollama serve not started on a headless box; OLLAMA_HOST=0.0.0.0 or a custom port so 127.0.0.1:11434 is not bound; system reboot without autostart.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- Error fetching tags
- HTTP from \n\n
- Error parsing Ollama response
- Failed to embed chunk
- Failed to fetch Ollama library
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/454d099bad108d20.
Report an issue: GitHub.
Appendix: source
Thrown at core/llm/index.ts:500
} else if (e.message.includes("/api/show")) {
throw new Error(
`HTTP ${e.response.status} ${e.response.statusText} from ${e.response.url}\n\n${e.response.body}`,
);
} else {
if (!isAbortError(e)) {
// Don't pollute console with abort errors. Check on name instead of instanceof, to avoid importing node-fetch here
console.debug(
`${e.message}\n\nCode: ${e.code}\nError number: ${e.errno}\nSyscall: ${e.erroredSysCall}\nType: ${e.type}\n\n${e.stack}`,
);
}
if (
e.code === "ECONNREFUSED" &&
e.message.includes("http://127.0.0.1:11434")
) {
const message = (await isOllamaInstalled())
? "Unable to connect to local Ollama instance. Ollama may not be running."
: "Unable to connect to local Ollama instance. Ollama may not be installed or may not running.";
throw new Error(message);
}
if (
e.code === "ECONNREFUSED" &&
e.message.includes("http://localhost:8000")
) {
const isInstalled = await isLemonadeInstalled();
let message: string;
if (process.platform === "linux") {
// On Linux, isLemonadeInstalled checks if it's running (via health endpoint)
message =
"Unable to connect to local Lemonade instance. Please ensure Lemonade is running. Visit http://lemonade-server.ai for setup instructions.";
} else {
// On Windows, we can check if it's installed
message = isInstalled
? "Unable to connect to local Lemonade instance. Lemonade server may not be running."
: "Unable to connect to local Lemonade instance. Lemonade may not be installed or may not be running.";
}
throw new Error(message);View on GitHub (pinned to 5522c6f44c)