janhq/jan · error

No safetensors file found in repository

Error message

No safetensors file found in repository

What it means

Thrown during MLX model import in MlxModelDownloadAction when the model repository's file listing contains no file ending in .safetensors. The action first locates MLX model files, then picks the first *.safetensors entry as the main model file to download (the extension downloads the remaining related files). This guard fires when that find() returns undefined — i.e., the repo exists and has files, but none are safetensors weights (wrong repo type, a GGUF/PyTorch-only repo, or an incomplete upload). It is a sentinel validation error that aborts the import flow early rather than letting the download step fail later.

Solutions

  1. Choose a repository that ships MLX-compatible .safetensors weights (e.g. repos with '-mlx' suffix)
  2. If the repo is GGUF-only, use the llama.cpp import flow instead
  3. Convert the weights to safetensors/MLX format upstream and push them to a repo before importing
Defensive patterns

Strategy: validation

Validate before calling

const hasSafetensors = (files: { rfilename: string }[]) =>
  files.some((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))
if (!hasSafetensors(modelFiles)) {
  showToast('This repo has no .safetensors weights; MLX import requires them.')
  return
}

Type guard

const isSafetensorsFile = (f: { rfilename: string }): boolean =>
  f.rfilename.toLowerCase().endsWith('.safetensors')

Try / catch

try {
  await importMlxModel(modelPath)
} catch (e) {
  if (e.message === 'No safetensors file found in repository') {
    suggestLlamaCppImport(modelPath)
  }
}

Prevention

When it happens

Trigger: modelFiles.find(f => f.rfilename.toLowerCase().endsWith('.safetensors')) returns undefined because the repository only ships other formats (e.g. GGUF, PyTorch .bin/.pth, ONNX) or only config/tokenizer files.

Common situations: Importing a GGUF-only repo into the MLX flow, importing a repo that stores weights in .bin or .pth format, or importing a repo with only README/config files (no weights at all).

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

        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
      // and the extension will download all related files
      const mainSafetensorsFile = modelFiles.find((f) =>
        f.rfilename.toLowerCase().endsWith('.safetensors')
      )

      if (!mainSafetensorsFile) {
        throw new Error('No safetensors file found in repository')
      }

      const modelUrl = `https://huggingface.co/${modelPath}/resolve/main/${mainSafetensorsFile.rfilename}`

      // Prepare additional files to download (all model files except main safetensors)
      // Don't pass sha256/size to skip verification for MLX models
      const extraFiles = modelFiles
        .filter((f) => f.rfilename !== mainSafetensorsFile.rfilename)
        .map((file) => ({
          url: `https://huggingface.co/${modelPath}/resolve/main/${file.rfilename}`,
          filename: file.rfilename,
        }))

      return engine.import(modelId, {
        modelPath: modelUrl,
        files: extraFiles,
      })
    } catch (error) {

View on GitHub (pinned to 7205d770c1)