{"record":{"id":"5b7f1fb7a96e3ac8","repo":"janhq/jan","slug":"models-endpoint-not-found-for-provider-provider","errorCode":null,"errorMessage":"Models endpoint not found for ${provider.provider}. Check the base URL configuration.","messagePattern":"Models endpoint not found for (.+?)\\. Check the base URL configuration\\.","errorType":"exception","errorClass":null,"httpStatus":404,"severity":"error","filePath":"web-app/src/services/providers/tauri.ts","lineNumber":213,"sourceCode":"          [401, 403, 429].includes(response.status) &&\n          ki < keyAttempts.length - 1\n        ) {\n          continue\n        }\n\n        if (!response.ok) {\n          if (response.status === 401) {\n            throw new Error(\n              `Authentication failed: API key is required or invalid for ${provider.provider}`\n            )\n          }\n          if (response.status === 403) {\n            throw new Error(\n              `Access forbidden: Check your API key permissions for ${provider.provider}`\n            )\n          }\n          if (response.status === 404) {\n            throw new Error(\n              `Models endpoint not found for ${provider.provider}. Check the base URL configuration.`\n            )\n          }\n          throw new Error(\n            `Failed to fetch models from ${provider.provider}: ${response.status} ${response.statusText}`\n          )\n        }\n\n        const data = await response.json()\n\n        if (data.data && Array.isArray(data.data)) {\n          return data.data\n            .map((model: { id: string }) => model.id)\n            .filter(Boolean)\n        }\n        if (Array.isArray(data)) {\n          return data\n            .filter(Boolean)","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/web-app/src/services/providers/tauri.ts#L195-L231","documentation":"Thrown when the provider's /models endpoint responds with HTTP 404. The service is reachable and authenticated but there is no /models route at the configured base URL, almost always because the base URL is wrong, missing a version path (e.g. /v1), or points at a server exposing a different API surface.","triggerScenarios":"GET `${provider.base_url}/models` returned 404; e.g. base_url 'https://api.openai.com' (missing /v1) or an llamacpp/Ollama server without that route mounted.","commonSituations":"Base URL typed without the /v1 (or /api) prefix; pointing at the chat/completions host instead of the API root; self-hosted llama.cpp server with a different route layout; reverse proxy stripping or not routing the path.","solutions":["Fix the base URL to include the full API root, e.g. 'https://api.openai.com/v1'.","Confirm the endpoint's model-list route with curl: `curl <base_url>/models`.","If the server uses a non-standard route, add a custom_header/proxy or point base_url at a compatible path.","Check reverse-proxy/nginx routing so /models reaches the backend."],"exampleFix":"// before\nbase_url: 'https://api.openai.com'\n// after\nbase_url: 'https://api.openai.com/v1'","handlingStrategy":"validation","validationCode":"function looksLikeApiRoot(url: string): boolean {\n  try { const u = new URL(url); return u.pathname === '' || /v\\d+|api|v1/.test(u.pathname) } catch { return false }\n}\nif (!looksLikeApiRoot(provider.base_url)) throw new Error('base_url should be the full API root, e.g. https://api.openai.com/v1')","typeGuard":"function isValidHttpUrl(v: string): boolean {\n  try { const u = new URL(v); return u.protocol === 'http:' || u.protocol === 'https:' } catch { return false }\n}","tryCatchPattern":"try {\n  await fetchModelsFromProvider(provider)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Models endpoint not found')) {\n    promptFixBaseUrl(provider.provider) // suggest appending /v1\n  }\n}","preventionTips":["Always store the full API root including version segment (/v1, /api).","Validate base_url with curl before saving it in settings.","Check the provider docs for the exact models-list path."],"tags":["http-404","base-url","configuration","network"],"backgroundTag":"resource-not-found","analyzedSha":"7205d770c1e097c3daf35a911176410e93bc5564","analyzedAt":"2026-09-17T14:27:30.100Z","contentChangedAt":"2026-09-17T14:27:30.100Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}