{"record":{"id":"454d099bad108d20","repo":"continuedev/continue","slug":"unable-to-connect-to-local-ollama-instance-ollama","errorCode":null,"errorMessage":"Unable to connect to local Ollama instance. Ollama may not be running.","messagePattern":"Unable to connect to local Ollama instance\\. Ollama may not be running\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/llm/index.ts","lineNumber":500,"sourceCode":"        } else if (e.message.includes(\"/api/show\")) {\n          throw new Error(\n            `HTTP ${e.response.status} ${e.response.statusText} from ${e.response.url}\\n\\n${e.response.body}`,\n          );\n        } else {\n          if (!isAbortError(e)) {\n            // Don't pollute console with abort errors. Check on name instead of instanceof, to avoid importing node-fetch here\n            console.debug(\n              `${e.message}\\n\\nCode: ${e.code}\\nError number: ${e.errno}\\nSyscall: ${e.erroredSysCall}\\nType: ${e.type}\\n\\n${e.stack}`,\n            );\n          }\n          if (\n            e.code === \"ECONNREFUSED\" &&\n            e.message.includes(\"http://127.0.0.1:11434\")\n          ) {\n            const message = (await isOllamaInstalled())\n              ? \"Unable to connect to local Ollama instance. Ollama may not be running.\"\n              : \"Unable to connect to local Ollama instance. Ollama may not be installed or may not running.\";\n            throw new Error(message);\n          }\n          if (\n            e.code === \"ECONNREFUSED\" &&\n            e.message.includes(\"http://localhost:8000\")\n          ) {\n            const isInstalled = await isLemonadeInstalled();\n            let message: string;\n            if (process.platform === \"linux\") {\n              // On Linux, isLemonadeInstalled checks if it's running (via health endpoint)\n              message =\n                \"Unable to connect to local Lemonade instance. Please ensure Lemonade is running. Visit http://lemonade-server.ai for setup instructions.\";\n            } else {\n              // On Windows, we can check if it's installed\n              message = isInstalled\n                ? \"Unable to connect to local Lemonade instance. Lemonade server may not be running.\"\n                : \"Unable to connect to local Lemonade instance. Lemonade may not be installed or may not be running.\";\n            }\n            throw new Error(message);","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/index.ts#L482-L518","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\n# ECONNREFUSED http://127.0.0.1:11434\n# after\nollama serve &\ncurl http://127.0.0.1:11434/api/tags  # 200 {\"models\":[...]}","handlingStrategy":"retry","validationCode":"const up = await fetch('http://127.0.0.1:11434/api/tags').then(r => r.ok).catch(() => false); if (!up) await spawn('ollama', ['serve']);","typeGuard":null,"tryCatchPattern":"catch (e) { if (e.message.includes('Unable to connect to local Ollama')) { await startOllamaAndWaitForPort(11434); retry(); } else throw e; }","preventionTips":["Autostart ollama serve (systemd/login item)","Verify port matches OLLAMA_HOST","Probe 127.0.0.1:11434 before first request"],"tags":["ollama","connection-refused","local-server","not-running"],"backgroundTag":"connection-refused","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}