{"record":{"id":"96ed2584ceb869dc","repo":"janhq/jan","slug":"error-message-96ed25","errorCode":null,"errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web-app/src/services/providers/tauri.ts","lineNumber":267,"sourceCode":"      )\n    } catch (error) {\n      console.error('Error fetching models from provider:', error)\n\n      // Preserve structured error messages thrown above\n      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,","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/web-app/src/services/providers/tauri.ts#L249-L285","documentation":"A pass-through re-throw inside getModels' catch block. When the caught error's message starts with one of the structured prefixes ('Authentication failed', 'Access forbidden', 'Models endpoint not found', or 'Failed to fetch models from') it re-wraps and re-throws the identical message so callers receive the original human-readable cause instead of the generic connection/fallback wrappers below it.","triggerScenarios":"Any of the structured throws inside the try block (the 401, 403, 404 handlers, error 160, or error 161) is caught by the surrounding try/catch and matched by prefix, then re-thrown verbatim here.","commonSituations":"Normal error propagation. This is a relay, not a new failure - the real cause is the structured throw whose message is being preserved.","solutions":["Read error.message to find the real cause; this line just preserves a deeper throw.","Trace back to the matching structured throw (401/403/404 handler or error 160/161) for the actual fix."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const STRUCTURED_PREFIXES = [\n  'Authentication failed',\n  'Access forbidden',\n  'Models endpoint not found',\n  'Failed to fetch models from',\n]\nfunction isStructuredProviderError(e: unknown): boolean {\n  return e instanceof Error && STRUCTURED_PREFIXES.some(p => e.message.startsWith(p))\n}","tryCatchPattern":"try {\n  models = await provider.getModels(p)\n} catch (e) {\n  if (isStructuredProviderError(e)) showErrorToast(e.message)\n  else throw e\n}","preventionTips":["Do not swallow this in a generic catch - the message is intended for the user.","Differentiate structured errors from connection/generic ones for cleaner UX."],"tags":["error-propagation","passthrough","provider-api","models"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}