janhq/jan · error · Error
Folder not found
Error message
Folder not found: ${sourcePath} What it means
When opts.modelPath is not an https:// URL, import() treats it as a local folder to copy/register. It verifies the folder exists with fs.existsSync and throws this error if it does not, since the import cannot proceed without a source model directory.
Solutions
- Verify the path exists and is a directory (fs.existsSync + stat.isDirectory()) before calling import
- Pass an absolute path instead of a relative one
- Correct typos or re-point modelPath at the folder containing the model weights/config
- For remote models pass an https:// URL in modelPath so the download branch is used instead
Example fix
// before
await mlx.import('my-model', { modelPath: '~/Downloads/llama-mlx' }) // may not resolve
// after
const p = '/Users/me/Downloads/llama-mlx'
if (!(await fs.existsSync(p))) throw new Error(`Check path: ${p}`)
await mlx.import('my-model', { modelPath: p }) Defensive patterns
Strategy: validation
Validate before calling
import fs from 'path-browserify'
const stat = await fs.fileStat(sourcePath)
if (!stat || !stat.isDirectory()) throw new Error(`modelPath is not an existing folder: ${sourcePath}`) Try / catch
try {
await mlx.import(modelId, { modelPath })
} catch (e) {
if (String(e).startsWith('Folder not found')) {
throw new Error(`Verify the model folder path: ${modelPath}`)
}
throw e
} Prevention
- Always pass absolute paths; resolve relative paths against a known base
- Confirm the path is a directory containing model files, not a single file
- Re-verify paths after moving or reorganizing model folders
- Use https:// URLs in modelPath for remote models instead of local staging
When it happens
Trigger: Calling MlxExtension.import(modelId, { modelPath: '/local/path' }) where the path does not exist, is a file rather than a folder, was moved/renamed, or the process lacks access so existsSync reports false.
Common situations: Typo or stale path after moving a downloaded model folder; relative path resolved against the wrong working directory; pointing at a single model file instead of its parent folder; permissions or sandbox blocking access to the path.
Related errors
- Model already exists
- Executable must have a parent directory
- Failed to decompress archive
- Failed to normalize backend layout
- File not found
AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17).
Data as JSON: /api/errors/2c8f607327ad8525.
Report an issue: GitHub.
Appendix: source
Thrown at extensions/mlx-extension/src/index.ts:740
data: modelConfig,
savePath: configPath,
})
events.emit(AppEvent.onModelImported, {
modelId,
modelPath: modelConfig.model_path,
size_bytes: modelConfig.size_bytes,
capabilities: capabilities,
})
events.emit(DownloadEvent.onFileDownloadAndVerificationSuccess, {
modelId,
downloadType: 'Model',
})
} else {
// Local folder - use absolute folder path directly
if (!(await fs.existsSync(sourcePath))) {
throw new Error(`Folder not found: ${sourcePath}`)
}
// Get folder size
const stat = await fs.fileStat(sourcePath)
const size_bytes = stat.size
// Detect capabilities by checking model folder
const isVision = await this.isVisionSupported(sourcePath)
// Build capabilities array
const capabilities: string[] = []
if (isVision) capabilities.push('vision')
// Create model.yml with absolute folder path
const modelConfig: any = {
model_path: sourcePath,
name: modelId,
size_bytes,View on GitHub (pinned to 7205d770c1)