{"record":{"id":"b536f607a9a3ed7a","repo":"janhq/jan","slug":"failed-to-fetch-repository-files","errorCode":null,"errorMessage":"Failed to fetch repository files","messagePattern":"Failed to fetch repository files","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"web-app/src/containers/MlxModelDownloadAction.tsx","lineNumber":121,"sourceCode":"          id: downloadedModelId,\n          provider: 'mlx',\n        },\n      },\n    })\n  }, [navigate, downloadedModelId])\n\n  const handleDownloadMlxModel = useCallback(async () => {\n    addLocalDownloadingModel(modelId)\n\n    const modelPath = `${model.developer}/${modelName}`\n    try {\n      // Fetch repository info to get all files\n      const repoInfo = await serviceHub\n        .models()\n        .fetchHuggingFaceRepo(modelPath, huggingfaceToken)\n\n      if (!repoInfo || !repoInfo.siblings) {\n        throw new Error('Failed to fetch repository files')\n      }\n\n      // Filter relevant model files for MLX\n      const modelFiles = repoInfo.siblings\n\n      if (modelFiles.length === 0) {\n        throw new Error('No MLX model files found in repository')\n      }\n\n      // Get the MLX engine and import\n      const engine = EngineManager.instance().get(\n        'mlx'\n      )\n      if (!engine) {\n        throw new Error('MLX engine not found')\n      }\n\n      // For MLX, we download the first safetensors file as the main model","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/web-app/src/containers/MlxModelDownloadAction.tsx#L103-L139","documentation":"Thrown in MlxModelDownloadAction when the Hugging Face repository info fetch via serviceHub.models().fetchHuggingFaceRepo returns a falsy value or an object without a `siblings` array. It signals that the repo file listing could not be retrieved, so the MLX import flow cannot proceed.","triggerScenarios":"Calling fetchHuggingFaceRepo(modelPath, huggingfaceToken) resolves to null/undefined, or to a repo object lacking the `siblings` field — e.g. the repo does not exist, the modelPath is malformed, the token is invalid/missing for a gated repo, or the underlying HTTP request failed and was swallowed into a null return.","commonSituations":"Typing a wrong Hugging Face repo id (e.g. 'org/model-name' misspelled), importing a gated or private model without a valid token, network connectivity issues, or Hugging Face API rate limiting returning an empty body.","solutions":["Verify the modelPath is a valid Hugging Face repo id (owner/name) and that the repo exists and is public","Provide a valid Hugging Face token in the token field if the repo is gated or private","Check network connectivity / proxy settings and retry","Inspect the extension logs for the underlying fetch failure from fetchHuggingFaceRepo"],"exampleFix":"// before\nconst repoInfo = await serviceHub.models().fetchHuggingFaceRepo(modelPath, huggingfaceToken)\nif (!repoInfo || !repoInfo.siblings) throw new Error('Failed to fetch repository files')\n// after\nconst repoInfo = await serviceHub.models().fetchHuggingFaceRepo(modelPath, huggingfaceToken)\nif (!repoInfo?.siblings) {\n  console.error('HF repo fetch failed for', modelPath, 'token set:', !!huggingfaceToken)\n  alert(`Repository \"${modelPath}\" could not be fetched. Check the repo id and token.`)\n  return\n}","handlingStrategy":"validation","validationCode":"const isHfRepoId = (s: string) => /^[\\w.-]+\\/[\\w.-]+$/.test(s.trim())\nif (!isHfRepoId(modelPath)) throw new Error(`Invalid Hugging Face repo id: ${modelPath}`)","typeGuard":"const hasSiblings = (r: unknown): r is { siblings: { rfilename: string }[] } =>\n  !!r && typeof r === 'object' && Array.isArray((r as any).siblings)","tryCatchPattern":"try {\n  const repoInfo = await serviceHub.models().fetchHuggingFaceRepo(modelPath, token)\n  if (!repoInfo?.siblings) throw new Error('Failed to fetch repository files')\n} catch (e) {\n  showToast(`Could not load repo ${modelPath}. Check repo id, token, and network.`)\n}","preventionTips":["Validate the repo id format before fetching","Require a token for gated/private repos","Log the underlying fetch failure for diagnosis","Add a retry with backoff for transient network errors"],"tags":["network","huggingface","api"],"backgroundTag":"empty-api-response","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"}