janhq/jan · warning · Error

No safetensors file found in repository

Error message

No safetensors file found in repository

What it means

Thrown when the repo has files (siblings non-empty) but none end in `.safetensors`. The MLX download flow requires at least one safetensors weight file as the primary model; without it the import cannot proceed. This is distinct from error 123 (no files at all) — here the repo exists and has files, just not the right kind.

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 fad3f12a14)

Solutions

  1. Verify the repo advertises MLX-format safetensors (often tagged 'mlx' on HF).
  2. Pick a different quantization variant that ships `.safetensors`.
  3. If sharded, confirm the API returned all sibling files (the `?blobs=true&files_metadata=true` flags are set in fetchHuggingFaceRepo).

Example fix

// before
const mainSafetensorsFile = modelFiles.find((f) =>
  f.rfilename.toLowerCase().endsWith('.safetensors')
)
if (!mainSafetensorsFile) {
  throw new Error('No safetensors file found in repository')
}

// after
const mainSafetensorsFile = modelFiles.find((f) =>
  f.rfilename.toLowerCase().endsWith('.safetensors')
)
if (!mainSafetensorsFile) {
  const found = modelFiles.map((f) => f.rfilename).join(', ')
  throw new Error(
    `No .safetensors file in ${modelPath}. Found: ${found || 'none'}. Use an MLX-tagged repo.`
  )
}
Defensive patterns

Strategy: validation

Validate before calling

const safetensors = modelFiles.filter((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))
if (safetensors.length === 0) {
  toast.error('No safetensors weights', {
    description: `${modelPath} has no .safetensors. Use an MLX-tagged repo.`,
  })
  return
}

Type guard

function hasSafetensors(files: { rfilename: string }[]): boolean {
  return files.some((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))
}

Try / catch

if (!hasSafetensors(modelFiles)) {
  toast.error('No safetensors file found', {
    description: `Found: ${modelFiles.map((f) => f.rfilename).join(', ') || 'none'}`,
  })
  return
}

Prevention

When it happens

Trigger: `modelFiles.find((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))` returns undefined. Repo contains only `.gguf`, `.bin`, `.pt`, or non-weight files; or weights use an unexpected extension (e.g. `.safetensors.json` metadata only).

Common situations: Repo is GGUF-only (MLX needs safetensors); repo is a PyTorch-only mirror; user selected a non-MLX-quantized variant; repo only ships sharded safetensors under a subfolder the API metadata didn't expand.

Related errors


AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12). Data as JSON: /api/errors/82e559bb04b9b806. Report an issue: GitHub.