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

  1. Verify the path exists and is a directory (fs.existsSync + stat.isDirectory()) before calling import
  2. Pass an absolute path instead of a relative one
  3. Correct typos or re-point modelPath at the folder containing the model weights/config
  4. 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

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


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)