janhq/jan · error · Error
Folder not found: ${sourcePath}
Error message
Folder not found: ${sourcePath} What it means
Thrown by MlxExtension.import() in the local-folder branch (opts.modelPath is not an https:// URL) when fs.existsSync(sourcePath) is false. The extension validates the source folder exists on disk before reading its size or probing for vision support, so a stale, relative, or mistyped path fails fast rather than producing an empty model config.
Source
Thrown at extensions/mlx-extension/src/index.ts:710
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 fad3f12a14)
Solutions
- Verify the path exists and is absolute before calling import: check with fs.realpathSync(sourcePath).
- Re-download or re-extract the model folder to the expected location.
- Mount the external/removable volume that holds the model before importing.
- On Windows/WSL, convert the path to the format Node can resolve (e.g. /mnt/c/... or a native Win32 path).
Example fix
// before
await mlx.import(modelId, { modelPath: userInputPath })
// after
const resolved = path.resolve(userInputPath)
if (!fs.existsSync(resolved)) {
throw new Error(`Model folder missing, re-download it: ${resolved}`)
}
await mlx.import(modelId, { modelPath: resolved }) Defensive patterns
Strategy: validation
Validate before calling
import { existsSync, realpathSync } from 'fs'
import { resolve } from 'path'
function assertFolderExists(p: string): string {
const abs = resolve(p)
if (!existsSync(abs)) throw new Error(`Model folder missing: ${abs}`)
return realpathSync(abs)
}
const safePath = assertFolderExists(opts.modelPath) Try / catch
try {
await mlx.import(modelId, opts)
} catch (e) {
if (e instanceof Error && e.message.startsWith('Folder not found')) {
promptUserToReDownloadOrRelocate()
} else throw e
} Prevention
- Always pass an absolute, resolved path as modelPath.
- Validate the folder exists immediately before import (not at selection time).
- Beware case-sensitive filesystems and WSL/Win32 path format differences.
When it happens
Trigger: Calling import with opts.modelPath pointing to a folder that was moved, deleted, or never downloaded; passing a relative path when an absolute path is required; the folder is on an external drive that is unmounted; path contains a typo or wrong casing on a case-sensitive filesystem.
Common situations: User selects a model folder, then moves/deletes it before import completes; script hard-codes a path that differs across machines; WSL/Windows path format mismatch (C:\ vs /mnt/c); symlink target missing.
Related errors
- Model ${modelId} already exists
- Model ${modelId} already exists
- File not found: ${path}
- Model ${modelId} does not exist
- Model with ID ${model.id} already exists
AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12).
Data as JSON: /api/errors/2c8f607327ad8525.
Report an issue: GitHub.