{"record":{"id":"a1dd9c359e3f2dc9","repo":"shadcn-ui/ui","slug":"file-not-found-options-path","errorCode":null,"errorMessage":"File not found: ${options.path}","messagePattern":"File not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-icons.ts","lineNumber":85,"sourceCode":"  let basePath: string\n\n  if (options.path) {\n    // User provided a path/glob.\n    basePath = config.resolvedPaths.cwd\n    const isGlob = options.path.includes(\"*\")\n\n    if (isGlob) {\n      files = await fg(options.path, {\n        cwd: basePath,\n        onlyFiles: true,\n        ignore: [\"**/node_modules/**\"],\n      })\n    } else {\n      const fullPath = path.resolve(basePath, options.path)\n      const stat = await fs.stat(fullPath).catch(() => null)\n\n      if (!stat) {\n        throw new Error(`File not found: ${options.path}`)\n      }\n\n      if (stat.isDirectory()) {\n        basePath = fullPath\n        files = await fg(\"**/*.{js,ts,jsx,tsx}\", {\n          cwd: basePath,\n          onlyFiles: true,\n          ignore: [\"**/node_modules/**\"],\n        })\n      } else if (stat.isFile()) {\n        files = [options.path]\n      } else {\n        throw new Error(`Unsupported path type: ${options.path}`)\n      }\n    }\n\n    if (files.length === 0) {\n      throw new Error(`No files found matching: ${options.path}`)","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/migrations/migrate-icons.ts#L67-L103","documentation":"During `shadcn migrate icons --path <p>`, when <p> is not a glob and fs.stat resolves to null (ENOENT), the path does not exist on disk. Note the path is resolved against config.resolvedPaths.cwd, NOT the shell's process.cwd().","triggerScenarios":"Passing --path to `shadcn migrate icons` that does not resolve under the project's configured cwd (config.resolvedPaths.cwd).","commonSituations":"Typo in path, wrong relative path (resolved against config cwd not shell cwd), file moved/deleted between planning and execution, running migrate from a subdirectory.","solutions":["Verify the path exists: `ls <path>` from the project root.","Use an absolute path to avoid cwd confusion.","Drop --path entirely to migrate the configured `ui` directory from components.json."],"exampleFix":"// before\nshadcn migrate icons --path ./src/components\n// after (absolute, or omit)\nshadcn migrate icons --path /abs/path/to/components\n// or: shadcn migrate icons   (uses components.json `ui`)","handlingStrategy":"validation","validationCode":"import fs from \"fs-extra\"\nimport path from \"path\"\n\nasync function assertMigratePathExists(configCwd: string, p: string) {\n  // NOTE: resolved against config.resolvedPaths.cwd, not process.cwd().\n  if (!p.includes(\"*\")) {\n    const stat = await fs.stat(path.resolve(configCwd, p)).catch(() => null)\n    if (!stat) throw new Error(`File not found: ${p}`)\n  }\n}","typeGuard":"import fs from \"fs-extra\"\nimport path from \"path\"\n\nasync function isExistingMigratePath(configCwd: string, p: string): Promise<boolean> {\n  if (p.includes(\"*\")) return true\n  const stat = await fs.stat(path.resolve(configCwd, p)).catch(() => null)\n  return !!stat\n}","tryCatchPattern":null,"preventionTips":["Prefer absolute paths for --path.","Remember --path is relative to config.resolvedPaths.cwd, not the shell cwd."],"tags":["migrate","filesystem","validation","icons"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}