{"record":{"id":"2c8f607327ad8525","repo":"janhq/jan","slug":"folder-not-found-sourcepath","errorCode":null,"errorMessage":"Folder not found: ${sourcePath}","messagePattern":"Folder not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/mlx-extension/src/index.ts","lineNumber":710,"sourceCode":"        data: modelConfig,\n        savePath: configPath,\n      })\n\n      events.emit(AppEvent.onModelImported, {\n        modelId,\n        modelPath: modelConfig.model_path,\n        size_bytes: modelConfig.size_bytes,\n        capabilities: capabilities,\n      })\n\n      events.emit(DownloadEvent.onFileDownloadAndVerificationSuccess, {\n        modelId,\n        downloadType: 'Model',\n      })\n    } else {\n      // Local folder - use absolute folder path directly\n      if (!(await fs.existsSync(sourcePath))) {\n        throw new Error(`Folder not found: ${sourcePath}`)\n      }\n\n      // Get folder size\n      const stat = await fs.fileStat(sourcePath)\n      const size_bytes = stat.size\n\n      // Detect capabilities by checking model folder\n      const isVision = await this.isVisionSupported(sourcePath)\n\n      // Build capabilities array\n      const capabilities: string[] = []\n      if (isVision) capabilities.push('vision')\n\n      // Create model.yml with absolute folder path\n      const modelConfig: any = {\n        model_path: sourcePath,\n        name: modelId,\n        size_bytes,","sourceCodeStart":692,"sourceCodeEnd":728,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/extensions/mlx-extension/src/index.ts#L692-L728","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nawait mlx.import(modelId, { modelPath: userInputPath })\n\n// after\nconst resolved = path.resolve(userInputPath)\nif (!fs.existsSync(resolved)) {\n  throw new Error(`Model folder missing, re-download it: ${resolved}`)\n}\nawait mlx.import(modelId, { modelPath: resolved })","handlingStrategy":"validation","validationCode":"import { existsSync, realpathSync } from 'fs'\nimport { resolve } from 'path'\nfunction assertFolderExists(p: string): string {\n  const abs = resolve(p)\n  if (!existsSync(abs)) throw new Error(`Model folder missing: ${abs}`)\n  return realpathSync(abs)\n}\nconst safePath = assertFolderExists(opts.modelPath)","typeGuard":null,"tryCatchPattern":"try {\n  await mlx.import(modelId, opts)\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Folder not found')) {\n    promptUserToReDownloadOrRelocate()\n  } else throw e\n}","preventionTips":["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."],"tags":["filesystem","model-management","import","mlx","validation"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}