can1357/oh-my-pi · error

HTTP ${response.status} from ${baseUrl}/api/tags

Error message

HTTP ${response.status} from ${baseUrl}/api/tags

What it means

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.

Source

Thrown at packages/catalog/src/provider-models/ollama.ts:159

	const baseUrl = normalizeOllamaCloudBaseUrl(config?.baseUrl);
	let providerReferences: Map<string, ModelSpec<"ollama-chat">> | undefined;
	const getProviderReferences = () =>
		(providerReferences ??= createBundledReferenceMap<"ollama-chat">("ollama-cloud"));
	const resolveReference = createReferenceResolver(getProviderReferences);
	return {
		providerId: "ollama-cloud",
		fetchDynamicModels: async () => {
			if (!apiKey) {
				return [];
			}
			const response = await fetchWithRetry(`${baseUrl}/api/tags`, {
				method: "GET",
				headers: createCloudHeaders(apiKey),
				fetch: discoveryFetch(config?.fetch),
				defaultDelayMs: OLLAMA_RETRY_DELAYS_MS,
			});
			if (!response.ok) {
				throw new Error(`HTTP ${response.status} from ${baseUrl}/api/tags`);
			}
			const payload = (await response.json()) as { models?: OllamaTagEntry[] };
			const entries = payload.models ?? [];
			const models = await Promise.all(
				entries.map(async entry => {
					const id = entry.model ?? entry.name;
					if (!id) {
						return undefined;
					}
					const reference = resolveReference(id);
					const providerReference = getProviderReferences().get(id);
					let metadata: OllamaShowResponse | undefined;
					try {
						metadata = await fetchShowMetadata(baseUrl, apiKey, id, config?.fetch);
					} catch {
						metadata = undefined;
					}
					const capabilities = metadata?.capabilities;

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify Ollama is running and baseUrl (e.g. http://localhost:11434) is correct
  2. curl the endpoint: curl http://localhost:11434/api/tags and compare the status
  3. Check/refresh the API key in createCloudHeaders if hitting ollama.com
  4. Update Ollama if /api/tags returns 404 (older versions differ)

Example fix

// before
baseUrl = "http://localhost:8080"; // wrong port
// after
baseUrl = "http://localhost:11434";
Defensive patterns

Strategy: retry

Validate before calling

const res = await fetch(`${baseUrl}/api/tags`, { headers: createCloudHeaders(apiKey) });
if (!res.ok) throw new Error(`Ollama unreachable: HTTP ${res.status} at ${baseUrl}`);

Try / catch

try {
  models = await fetchOllamaModels();
} catch (err) {
  if (err instanceof Error && err.message.includes("/api/tags")) {
    logger.warn("Ollama catalog fetch failed; skipping dynamic models", { cause: err });
    return [];
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: OLLAMA_BASE_URL pointing at the wrong port/host, Ollama not running, reverse proxy intercepting the request, stale auth header for ollama.com cloud.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/1e2630bf734fa4d9. Report an issue: GitHub.