{"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":null,"httpStatus":null,"severity":"error","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/7205d770c1e097c3daf35a911176410e93bc5564/web-app/src/containers/MlxModelDownloadAction.tsx#L128-L164","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Choose a repository that ships MLX-compatible .safetensors weights (e.g. repos with '-mlx' suffix)","If the repo is GGUF-only, use the llama.cpp import flow instead","Convert the weights to safetensors/MLX format upstream and push them to a repo before importing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const hasSafetensors = (files: { rfilename: string }[]) =>\n  files.some((f) => f.rfilename.toLowerCase().endsWith('.safetensors'))\nif (!hasSafetensors(modelFiles)) {\n  showToast('This repo has no .safetensors weights; MLX import requires them.')\n  return\n}","typeGuard":"const isSafetensorsFile = (f: { rfilename: string }): boolean =>\n  f.rfilename.toLowerCase().endsWith('.safetensors')","tryCatchPattern":"try {\n  await importMlxModel(modelPath)\n} catch (e) {\n  if (e.message === 'No safetensors file found in repository') {\n    suggestLlamaCppImport(modelPath)\n  }\n}","preventionTips":["Filter repo suggestions to safetensors/MLX repos","Detect weight format before starting import","Offer the llama.cpp path for GGUF-only repos","Show the detected file list in the import preview"],"tags":["huggingface","validation","model-format"],"backgroundTag":"resource-not-found","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"}