ruvnet/ruflo · error · LLMProviderError

OLLAMA_${response.status}

OLLAMA_${response.status}

Error message

Ollama error: ${errorText}

What it means

RuVectorProvider's Ollama bridge POSTs to `${ollamaUrl}/api/chat`; any non-ok response is wrapped in LLMProviderError with code `OLLAMA_<status>`, provider 'ruvector', and retryable=true. The message carries Ollama's raw response body, so the upstream cause (model missing, bad request, crash) is embedded verbatim.

Source

Thrown at v3/@claude-flow/providers/src/ruvector-provider.ts:295

      },
    };

    const controller = new AbortController();
    const timeout = setTimeout(() => controller.abort(), this.config.timeout || 120000);

    try {
      const response = await fetch(`${this.ollamaUrl}/api/chat`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(ollamaRequest),
        signal: controller.signal,
      });

      clearTimeout(timeout);

      if (!response.ok) {
        const errorText = await response.text();
        throw new LLMProviderError(
          `Ollama error: ${errorText}`,
          `OLLAMA_${response.status}`,
          'ruvector',
          response.status,
          true
        );
      }

      const data = await response.json() as {
        message?: { content: string };
        prompt_eval_count?: number;
        eval_count?: number;
      };

      const promptTokens = data.prompt_eval_count || this.estimateTokens(JSON.stringify(request.messages));
      const completionTokens = data.eval_count || this.estimateTokens(data.message?.content || '');

      return {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Verify the server and model: curl ${ollamaUrl}/api/tags should list the model you configured
  2. Pull the model: ollama pull llama3.2 (or set the config to an installed model name)
  3. Check ollamaUrl is scheme+host+port only (default http://localhost:11434) with no path suffix
  4. Read the errorText inside the message — it is Ollama's own response and names the real problem
  5. On 5xx it is safe to retry: the error is flagged retryable, so re-issue with backoff

Example fix

// before
config = { provider: 'ruvector', ollamaUrl: 'http://localhost:11434/v1', model: 'llama3.2' };
// → OLLAMA_404: '404 page not found'

// after
config = { provider: 'ruvector', ollamaUrl: 'http://localhost:11434', model: 'llama3.2' };
Defensive patterns

Strategy: retry

Validate before calling

async function ollamaReady(ollamaUrl: string, model: string): Promise<boolean> {
  try {
    const res = await fetch(`${ollamaUrl}/api/tags`);
    if (!res.ok) return false;
    const { models = [] } = await res.json();
    return models.some((m: { name: string }) => m.name.startsWith(model));
  } catch {
    return false;
  }
}
if (!(await ollamaReady(cfg.ollamaUrl, cfg.model))) throw new Error('Ollama or model not ready');

Type guard

import { isLLMProviderError } from './types.js';
function isOllamaStatusError(e: unknown, status?: number): boolean {
  return isLLMProviderError(e)
    && e.code.startsWith('OLLAMA_')
    && (status === undefined || e.statusCode === status);
}

Try / catch

for (let attempt = 1; attempt <= 3; attempt++) {
  try {
    return await provider.complete(request);
  } catch (e) {
    if (isOllamaStatusError(e) && e.retryable && (e.statusCode ?? 0) >= 500 && attempt < 3) {
      await new Promise((r) => setTimeout(r, 250 * 2 ** attempt));
      continue;
    }
    throw e;
  }
}

Prevention

When it happens

Trigger: 404 when the configured model was never pulled or ollamaUrl has a wrong path suffix like /v1; 400 when the local Ollama build rejects a request option; 500 when Ollama fails mid-generation; 502/503 from a reverse proxy in front of the Ollama port.

Common situations: Configured model name not present locally (forgot `ollama pull`); ollamaUrl accidentally includes /v1 (Ollama's native API lives under /api/*); old Ollama version lacking newer request fields; nginx/traefik in front of Ollama returning proxy error pages.

Related errors


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/a8f1229aae791a0f. Report an issue: GitHub.