{"record":{"id":"b2e13f6b18aae382","repo":"janhq/jan","slug":"cannot-connect-to-provider-provider-at-provid","errorCode":null,"errorMessage":"Cannot connect to ${provider.provider} at ${provider.base_url}. Please check that the service is running and accessible.","messagePattern":"Cannot connect to (.+?) at (.+?)\\. Please check that the service is running and accessible\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"web-app/src/services/providers/tauri.ts","lineNumber":272,"sourceCode":"      const structuredErrorPrefixes = [\n        'Authentication failed',\n        'Access forbidden',\n        'Models endpoint not found',\n        'Failed to fetch models from',\n      ]\n\n      if (\n        error instanceof Error &&\n        structuredErrorPrefixes.some((prefix) =>\n          (error as Error).message.startsWith(prefix)\n        )\n      ) {\n        throw new Error(error.message)\n      }\n\n      // Provide helpful error message for any connection errors\n      if (error instanceof Error && error.message.includes('fetch')) {\n        throw new Error(\n          `Cannot connect to ${provider.provider} at ${provider.base_url}. Please check that the service is running and accessible.`\n        )\n      }\n\n      // Generic fallback\n      throw new Error(\n        `Unexpected error while fetching models from ${provider.provider}: ${error instanceof Error ? error.message : 'Unknown error'}`\n      )\n    }\n  }\n\n  async updateSettings(\n    providerName: string,\n    settings: ProviderSetting[]\n  ): Promise<void> {\n    try {\n      // API keys are persisted to the OS keyring only (via\n      // register_provider_config), never to the extension's settings.json.","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/web-app/src/services/providers/tauri.ts#L254-L290","documentation":"Thrown when the underlying fetch itself failed (the error message contains 'fetch'), i.e. the request never got an HTTP response. The app translates low-level network failures into a friendly message saying the provider service at base_url could not be reached.","triggerScenarios":"fetchTauri throws a TypeError/fetch error: server not running, wrong port, DNS failure, TLS error, or the webview blocks the request (CORS/mixed content).","commonSituations":"Local llama.cpp/Ollama server not started or on a different port; base_url has a typo (http vs https, wrong host); remote provider unreachable offline; self-signed certificate rejected.","solutions":["Start/restart the local inference server and confirm it listens on the port in base_url.","Test connectivity: `curl <base_url>/models` from the same machine.","Correct the base_url scheme/host/port (e.g. http://localhost:8080 vs https).","If remote, check DNS/firewall/VPN and that the provider is up."],"exampleFix":"// before\nbase_url: 'http://localhost:1337' // server actually on 8080\n// after\nbase_url: 'http://localhost:8080'","handlingStrategy":"try-catch","validationCode":"// Cheap reachability probe before the real call\nasync function isReachable(base_url: string): Promise<boolean> {\n  try { await fetch(base_url.replace(/\\/$/, '') + '/models', { method: 'HEAD' }); return true } catch { return false }\n}","typeGuard":"function isLocalUrl(url: string): boolean {\n  return url.includes('localhost:') || url.includes('127.0.0.1:')\n}","tryCatchPattern":"try {\n  await fetchModelsFromProvider(provider)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Cannot connect to')) {\n    guideStartLocalServer(provider.base_url) // show start-server instructions\n  }\n}","preventionTips":["Check the local server is running before listing models.","Validate scheme/host/port of base_url during configuration.","Surface a health-check indicator for local providers in the UI."],"tags":["network","connection","fetch","configuration"],"backgroundTag":"connection-refused","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"}