janhq/jan · error

Failed to fetch repository files

Error message

Failed to fetch repository files

What it means

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.

Solutions

  1. Verify the modelPath is a valid Hugging Face repo id (owner/name) and that the repo exists and is public
  2. Provide a valid Hugging Face token in the token field if the repo is gated or private
  3. Check network connectivity / proxy settings and retry
  4. Inspect the extension logs for the underlying fetch failure from fetchHuggingFaceRepo

Example fix

// before
const repoInfo = await serviceHub.models().fetchHuggingFaceRepo(modelPath, huggingfaceToken)
if (!repoInfo || !repoInfo.siblings) throw new Error('Failed to fetch repository files')
// after
const repoInfo = await serviceHub.models().fetchHuggingFaceRepo(modelPath, huggingfaceToken)
if (!repoInfo?.siblings) {
  console.error('HF repo fetch failed for', modelPath, 'token set:', !!huggingfaceToken)
  alert(`Repository "${modelPath}" could not be fetched. Check the repo id and token.`)
  return
}
Defensive patterns

Strategy: validation

Validate before calling

const isHfRepoId = (s: string) => /^[\w.-]+\/[\w.-]+$/.test(s.trim())
if (!isHfRepoId(modelPath)) throw new Error(`Invalid Hugging Face repo id: ${modelPath}`)

Type guard

const hasSiblings = (r: unknown): r is { siblings: { rfilename: string }[] } =>
  !!r && typeof r === 'object' && Array.isArray((r as any).siblings)

Try / catch

try {
  const repoInfo = await serviceHub.models().fetchHuggingFaceRepo(modelPath, token)
  if (!repoInfo?.siblings) throw new Error('Failed to fetch repository files')
} catch (e) {
  showToast(`Could not load repo ${modelPath}. Check repo id, token, and network.`)
}

Prevention

When it happens

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

Common situations: 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.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17). Data as JSON: /api/errors/b536f607a9a3ed7a. Report an issue: GitHub.

Appendix: source

Thrown at web-app/src/containers/MlxModelDownloadAction.tsx:121

          id: downloadedModelId,
          provider: 'mlx',
        },
      },
    })
  }, [navigate, downloadedModelId])

  const handleDownloadMlxModel = useCallback(async () => {
    addLocalDownloadingModel(modelId)

    const modelPath = `${model.developer}/${modelName}`
    try {
      // Fetch repository info to get all files
      const repoInfo = await serviceHub
        .models()
        .fetchHuggingFaceRepo(modelPath, huggingfaceToken)

      if (!repoInfo || !repoInfo.siblings) {
        throw new Error('Failed to fetch repository files')
      }

      // Filter relevant model files for MLX
      const modelFiles = repoInfo.siblings

      if (modelFiles.length === 0) {
        throw new Error('No MLX model files found in repository')
      }

      // Get the MLX engine and import
      const engine = EngineManager.instance().get(
        'mlx'
      )
      if (!engine) {
        throw new Error('MLX engine not found')
      }

      // For MLX, we download the first safetensors file as the main model

View on GitHub (pinned to 7205d770c1)