{"record":{"id":"1e2630bf734fa4d9","repo":"can1357/oh-my-pi","slug":"http-response-status-from-baseurl-api-tags","errorCode":null,"errorMessage":"HTTP ${response.status} from ${baseUrl}/api/tags","messagePattern":"HTTP (.+?) from (.+?)/api/tags","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/catalog/src/provider-models/ollama.ts","lineNumber":159,"sourceCode":"\tconst baseUrl = normalizeOllamaCloudBaseUrl(config?.baseUrl);\n\tlet providerReferences: Map<string, ModelSpec<\"ollama-chat\">> | undefined;\n\tconst getProviderReferences = () =>\n\t\t(providerReferences ??= createBundledReferenceMap<\"ollama-chat\">(\"ollama-cloud\"));\n\tconst resolveReference = createReferenceResolver(getProviderReferences);\n\treturn {\n\t\tproviderId: \"ollama-cloud\",\n\t\tfetchDynamicModels: async () => {\n\t\t\tif (!apiKey) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst response = await fetchWithRetry(`${baseUrl}/api/tags`, {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\theaders: createCloudHeaders(apiKey),\n\t\t\t\tfetch: discoveryFetch(config?.fetch),\n\t\t\t\tdefaultDelayMs: OLLAMA_RETRY_DELAYS_MS,\n\t\t\t});\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(`HTTP ${response.status} from ${baseUrl}/api/tags`);\n\t\t\t}\n\t\t\tconst payload = (await response.json()) as { models?: OllamaTagEntry[] };\n\t\t\tconst entries = payload.models ?? [];\n\t\t\tconst models = await Promise.all(\n\t\t\t\tentries.map(async entry => {\n\t\t\t\t\tconst id = entry.model ?? entry.name;\n\t\t\t\t\tif (!id) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tconst reference = resolveReference(id);\n\t\t\t\t\tconst providerReference = getProviderReferences().get(id);\n\t\t\t\t\tlet metadata: OllamaShowResponse | undefined;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmetadata = await fetchShowMetadata(baseUrl, apiKey, id, config?.fetch);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tmetadata = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tconst capabilities = metadata?.capabilities;","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/catalog/src/provider-models/ollama.ts#L141-L177","documentation":"The Ollama cloud model manager queries GET {baseUrl}/api/tags to list locally/cloud-available models and throws this when the HTTP response is not ok (non-2xx). The status and endpoint are embedded in the message for diagnosis.","triggerScenarios":"GET /api/tags returns 404 (Ollama too old or wrong path), 401/403 (bad API key), 500 (server error), or hitting a non-Ollama server at baseUrl.","commonSituations":"OLLAMA_BASE_URL pointing at the wrong port/host, Ollama not running, reverse proxy intercepting the request, stale auth header for ollama.com cloud.","solutions":["Verify Ollama is running and baseUrl (e.g. http://localhost:11434) is correct","curl the endpoint: curl http://localhost:11434/api/tags and compare the status","Check/refresh the API key in createCloudHeaders if hitting ollama.com","Update Ollama if /api/tags returns 404 (older versions differ)"],"exampleFix":"// before\nbaseUrl = \"http://localhost:8080\"; // wrong port\n// after\nbaseUrl = \"http://localhost:11434\";","handlingStrategy":"retry","validationCode":"const res = await fetch(`${baseUrl}/api/tags`, { headers: createCloudHeaders(apiKey) });\nif (!res.ok) throw new Error(`Ollama unreachable: HTTP ${res.status} at ${baseUrl}`);\n","typeGuard":null,"tryCatchPattern":"try {\n  models = await fetchOllamaModels();\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"/api/tags\")) {\n    logger.warn(\"Ollama catalog fetch failed; skipping dynamic models\", { cause: err });\n    return [];\n  }\n  throw err;\n}","preventionTips":["Health-check baseUrl /api/tags at startup","Confirm Ollama is running and the port matches (default 11434)","Keep API keys current when using ollama.com cloud"],"tags":["network","http","ollama"],"backgroundTag":"http-request-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}