{"record":{"id":"a8f1229aae791a0f","repo":"ruvnet/ruflo","slug":"ollama-response-status-a8f122","errorCode":"OLLAMA_${response.status}","errorMessage":"Ollama error: ${errorText}","messagePattern":"Ollama error: (.+?)","errorType":"exception","errorClass":"LLMProviderError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/providers/src/ruvector-provider.ts","lineNumber":295,"sourceCode":"      },\n    };\n\n    const controller = new AbortController();\n    const timeout = setTimeout(() => controller.abort(), this.config.timeout || 120000);\n\n    try {\n      const response = await fetch(`${this.ollamaUrl}/api/chat`, {\n        method: 'POST',\n        headers: { 'Content-Type': 'application/json' },\n        body: JSON.stringify(ollamaRequest),\n        signal: controller.signal,\n      });\n\n      clearTimeout(timeout);\n\n      if (!response.ok) {\n        const errorText = await response.text();\n        throw new LLMProviderError(\n          `Ollama error: ${errorText}`,\n          `OLLAMA_${response.status}`,\n          'ruvector',\n          response.status,\n          true\n        );\n      }\n\n      const data = await response.json() as {\n        message?: { content: string };\n        prompt_eval_count?: number;\n        eval_count?: number;\n      };\n\n      const promptTokens = data.prompt_eval_count || this.estimateTokens(JSON.stringify(request.messages));\n      const completionTokens = data.eval_count || this.estimateTokens(data.message?.content || '');\n\n      return {","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/providers/src/ruvector-provider.ts#L277-L313","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the server and model: curl ${ollamaUrl}/api/tags should list the model you configured","Pull the model: ollama pull llama3.2 (or set the config to an installed model name)","Check ollamaUrl is scheme+host+port only (default http://localhost:11434) with no path suffix","Read the errorText inside the message — it is Ollama's own response and names the real problem","On 5xx it is safe to retry: the error is flagged retryable, so re-issue with backoff"],"exampleFix":"// before\nconfig = { provider: 'ruvector', ollamaUrl: 'http://localhost:11434/v1', model: 'llama3.2' };\n// → OLLAMA_404: '404 page not found'\n\n// after\nconfig = { provider: 'ruvector', ollamaUrl: 'http://localhost:11434', model: 'llama3.2' };","handlingStrategy":"retry","validationCode":"async function ollamaReady(ollamaUrl: string, model: string): Promise<boolean> {\n  try {\n    const res = await fetch(`${ollamaUrl}/api/tags`);\n    if (!res.ok) return false;\n    const { models = [] } = await res.json();\n    return models.some((m: { name: string }) => m.name.startsWith(model));\n  } catch {\n    return false;\n  }\n}\nif (!(await ollamaReady(cfg.ollamaUrl, cfg.model))) throw new Error('Ollama or model not ready');","typeGuard":"import { isLLMProviderError } from './types.js';\nfunction isOllamaStatusError(e: unknown, status?: number): boolean {\n  return isLLMProviderError(e)\n    && e.code.startsWith('OLLAMA_')\n    && (status === undefined || e.statusCode === status);\n}","tryCatchPattern":"for (let attempt = 1; attempt <= 3; attempt++) {\n  try {\n    return await provider.complete(request);\n  } catch (e) {\n    if (isOllamaStatusError(e) && e.retryable && (e.statusCode ?? 0) >= 500 && attempt < 3) {\n      await new Promise((r) => setTimeout(r, 250 * 2 ** attempt));\n      continue;\n    }\n    throw e;\n  }\n}","preventionTips":["Pre-flight GET /api/tags after initialize to confirm server and model presence","Keep ollamaUrl to scheme+host+port — no path suffix","Pin model names that exist locally and pull them in setup scripts/Dockerfiles"],"tags":["ollama","llm","http-status","retryable","local-server"],"backgroundTag":"ollama-http-error","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}