continuedev/continue · error · Error
res.error
Error message
res.error
What it means
Thrown by the convertChatMessage helper inside Ollama._streamChat when a streamed /api/chat JSON object contains an "error" field. Like the generate path, Ollama reports chat errors inline in the stream rather than via HTTP status codes.
Source
Thrown at core/llm/llms/Ollama.ts:541
}
const headers: Record<string, string> = {
"Content-Type": "application/json",
};
if (this.apiKey) {
headers.Authorization = `Bearer ${this.apiKey}`;
}
const response = await this.fetch(this.getEndpoint("api/chat"), {
method: "POST",
headers: headers,
body: JSON.stringify(chatOptions),
signal,
});
let isThinking: boolean = false;
function convertChatMessage(res: OllamaChatResponse): ChatMessage[] {
if ("error" in res) {
throw new Error(res.error);
}
if ("type" in res) {
const { content } = res;
if (content === "<think>") {
isThinking = true;
}
if (isThinking && content) {
// TODO better support for streaming thinking chunks, or remove this and depend on redux <think/> parsing logic
const thinkingMessage: ThinkingChatMessage = {
role: "thinking",
content: content,
};
if (thinkingMessage) {
// could cause issues with termination if chunk doesn't match this exactlyView on GitHub (pinned to 5522c6f44c)
Solutions
- Use the message text to identify the underlying cause; typically 'model ... not found' → ollama pull <model>
- For load failures, reduce model size or check VRAM with nvidia-smi
- Check `journalctl`/terminal output of ollama serve for the server-side error
Defensive patterns
Strategy: try-catch
Validate before calling
const ok = await fetch(`${ollamaHost}/api/tags`).then(r => r.ok);
if (ok) { const names = await Ollama.listModels(); if (!names.includes(model)) await Ollama.installModel(model, signal); } Type guard
function isOllamaChatInlineError(e: unknown): boolean { return e instanceof Error && /model .* not found|Error parsing Ollama/i.test(e.message); } Try / catch
try { for await (const m of llm.streamChat(messages, signal)) handle(m); }
catch (e) { if (isOllamaChatInlineError(e)) showModelHint(); else throw e; } Prevention
- Ensure chat models are pulled before streaming
- Monitor VRAM when loading large models
When it happens
Trigger: Chat streaming with a model that fails to load, an invalid model name, or unsupported request options in the /api/chat payload — Ollama emits {"error":"..."} as the first stream line.
Common situations: Switching models in config without pulling them, Ollama upgraded with breaking option changes, or GPU OOM when loading a large chat model.
Related errors
- j.error
- No tool use found
- Error parsing Ollama response: ${e} ${chunk}
- Unexpected message received from Ollama with role = tool
- MCP Connection ${serverId} not found
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/09cab25d4f0f9dc2.
Report an issue: GitHub.