{"record":{"id":"82e559bb04b9b806","repo":"janhq/jan","slug":"no-safetensors-file-found-in-repository","errorCode":null,"errorMessage":"No safetensors file found in repository","messagePattern":"No safetensors file found in repository","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"web-app/src/containers/MlxModelDownloadAction.tsx","lineNumber":146,"sourceCode":"        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\n      // and the extension will download all related files\n      const mainSafetensorsFile = modelFiles.find((f) =>\n        f.rfilename.toLowerCase().endsWith('.safetensors')\n      )\n\n      if (!mainSafetensorsFile) {\n        throw new Error('No safetensors file found in repository')\n      }\n\n      const modelUrl = `https://huggingface.co/${modelPath}/resolve/main/${mainSafetensorsFile.rfilename}`\n\n      // Prepare additional files to download (all model files except main safetensors)\n      // Don't pass sha256/size to skip verification for MLX models\n      const extraFiles = modelFiles\n        .filter((f) => f.rfilename !== mainSafetensorsFile.rfilename)\n        .map((file) => ({\n          url: `https://huggingface.co/${modelPath}/resolve/main/${file.rfilename}`,\n          filename: file.rfilename,\n        }))\n\n      return engine.import(modelId, {\n        modelPath: modelUrl,\n        files: extraFiles,\n      })\n    } catch (error) {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/web-app/src/containers/MlxModelDownloadAction.tsx#L128-L164","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","solutions":["Verify the repo advertises MLX-format safetensors (often tagged 'mlx' on HF).","Pick a different quantization variant that ships `.safetensors`.","If sharded, confirm the API returned all sibling files (the `?blobs=true&files_metadata=true` flags are set in fetchHuggingFaceRepo)."],"exampleFix":"// before\nconst mainSafetensorsFile = modelFiles.find((f) =>\n  f.rfilename.toLowerCase().endsWith('.safetensors')\n)\nif (!mainSafetensorsFile) {\n  throw new Error('No safetensors file found in repository')\n}\n\n// after\nconst mainSafetensorsFile = modelFiles.find((f) =>\n  f.rfilename.toLowerCase().endsWith('.safetensors')\n)\nif (!mainSafetensorsFile) {\n  const found = modelFiles.map((f) => f.rfilename).join(', ')\n  throw new Error(\n    `No .safetensors file in ${modelPath}. Found: ${found || 'none'}. Use an MLX-tagged repo.`\n  )\n}","handlingStrategy":"validation","validationCode":"const safetensors = modelFiles.filter((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))\nif (safetensors.length === 0) {\n  toast.error('No safetensors weights', {\n    description: `${modelPath} has no .safetensors. Use an MLX-tagged repo.`,\n  })\n  return\n}","typeGuard":"function hasSafetensors(files: { rfilename: string }[]): boolean {\n  return files.some((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))\n}","tryCatchPattern":"if (!hasSafetensors(modelFiles)) {\n  toast.error('No safetensors file found', {\n    description: `Found: ${modelFiles.map((f) => f.rfilename).join(', ') || 'none'}`,\n  })\n  return\n}","preventionTips":["Prefer repos tagged 'mlx' on HuggingFace which always ship safetensors.","List the available file types in the error so the user sees the mismatch."],"tags":["huggingface","mlx","safetensors","validation"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}