ruvnet/ruflo · error · LLMProviderError
OLLAMA_${response.status}
OLLAMA_${response.status}
Error message
${message} What it means
OllamaProvider's fallback for non-connection errors: LLMProviderError with code OLLAMA_<status>, and unlike the cloud providers it hardcodes retryable=true for every status. The message is Ollama's JSON error field ('Unknown error' if not JSON).
Source
Thrown at v3/@claude-flow/providers/src/ollama-provider.ts:399
const errorText = await response.text();
let errorData: { error?: string };
try {
errorData = JSON.parse(errorText);
} catch {
errorData = { error: errorText };
}
const message = errorData.error || 'Unknown error';
if (response.status === 0 || message.includes('connection')) {
throw new ProviderUnavailableError('ollama', {
message,
hint: 'Ensure Ollama is running: ollama serve',
});
}
throw new LLMProviderError(
message,
`OLLAMA_${response.status}`,
'ollama',
response.status,
true,
errorData
);
}
}
View on GitHub (pinned to fa13ee4ad6)
Solutions
- Run `ollama list` and use an exact tag from it, pulling if needed: `ollama pull llama3.1:8b`
- Read error.details.error - Ollama's message names the concrete cause (model missing, bad parameter, server error)
- For 5xx: retry with backoff; if it persists restart the daemon or upgrade Ollama to a version that supports the model
Example fix
// before
config: { model: 'llama3.1', apiUrl: 'http://localhost:11434' } // tag not pulled -> OLLAMA_404
// after
// $ ollama pull llama3.1:8b
config: { model: 'llama3.1:8b', apiUrl: 'http://localhost:11434' } // matches `ollama list` output Defensive patterns
Strategy: try-catch
Validate before calling
async function ollamaHasModel(model: string, apiUrl = 'http://localhost:11434'): Promise<boolean> {
const r = await fetch(`${apiUrl}/api/tags`);
const { models } = await r.json();
return (models ?? []).some((m: { name: string }) => m.name === model);
} Type guard
import { LLMProviderError, isLLMProviderError } from './types.js';
function isOllamaApiError(e: unknown): e is LLMProviderError {
return isLLMProviderError(e) && e.provider === 'ollama' && e.code.startsWith('OLLAMA_');
} Try / catch
try {
return await provider.complete(req);
} catch (e) {
if (isOllamaApiError(e)) {
// note: this mapping marks every status retryable; still inspect it first
if (e.statusCode === 404) throw new Error('model not pulled locally: run ollama pull ' + req.model);
return retryWithBackoff(() => provider.complete(req));
}
throw e;
} Prevention
- Verify model tags against `ollama list` (or GET /api/tags) before configuring the provider
- Pull required tags as part of environment provisioning (ollama pull in the setup script)
- Read e.details.error - Ollama names the exact cause for 400/404/500
When it happens
Trigger: complete() when the requested model tag has not been pulled (404 "model 'x' not found"), malformed request bodies (400), or Ollama server errors (500) - any non-connection HTTP response.
Common situations: Model tag typo or missing tag ('llama3.1' vs 'llama3.1:8b'); model pulled under a different name on another machine; Ollama version too old for a newer model/feature; corrupted model store.
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
- PROVIDER_UNAVAILABLE
- OLLAMA_${response.status}
- MCP server "${server.name}" is in cooldown (HTTP ${cd.status
- COHERE_${response.status}
- GOOGLE_${response.status}
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/3902de8a7e4878f9.
Report an issue: GitHub.