{"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":740,"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":722,"sourceCodeEnd":758,"githubUrl":"https://github.com/janhq/jan/blob/7205d770c1e097c3daf35a911176410e93bc5564/extensions/mlx-extension/src/index.ts#L722-L758","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait mlx.import('my-model', { modelPath: '~/Downloads/llama-mlx' }) // may not resolve\n// after\nconst p = '/Users/me/Downloads/llama-mlx'\nif (!(await fs.existsSync(p))) throw new Error(`Check path: ${p}`)\nawait mlx.import('my-model', { modelPath: p })","handlingStrategy":"validation","validationCode":"import fs from 'path-browserify'\nconst stat = await fs.fileStat(sourcePath)\nif (!stat || !stat.isDirectory()) throw new Error(`modelPath is not an existing folder: ${sourcePath}`)","typeGuard":null,"tryCatchPattern":"try {\n  await mlx.import(modelId, { modelPath })\n} catch (e) {\n  if (String(e).startsWith('Folder not found')) {\n    throw new Error(`Verify the model folder path: ${modelPath}`)\n  }\n  throw e\n}","preventionTips":["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"],"tags":["filesystem","path","model-import"],"backgroundTag":"directory-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"}