{"record":{"id":"cc3b3f741a54db23","repo":"shadcn-ui/ui","slug":"no-files-found-matching-migratepath","errorCode":null,"errorMessage":"No files found matching: ${migratePath}","messagePattern":"No files found matching: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/cn/files.ts","lineNumber":32,"sourceCode":"  \"**/.svelte-kit/**\",\n  \"**/.astro/**\",\n  \"**/.output/**\",\n  \"**/.vercel/**\",\n  \"**/dist/**\",\n  \"**/build/**\",\n  \"**/out/**\",\n  \"**/coverage/**\",\n]\n\nexport async function resolveMigrationFiles(cwd: string, migratePath?: string) {\n  if (!migratePath) {\n    return findSourceFiles(cwd)\n  }\n\n  if (migratePath.includes(\"*\")) {\n    const files = await findSourceFiles(cwd, migratePath)\n    if (!files.length) {\n      throw new Error(`No files found matching: ${migratePath}`)\n    }\n    return files\n  }\n\n  const resolvedPath = path.resolve(cwd, migratePath)\n  const stat = await fs.stat(resolvedPath).catch(() => null)\n  if (!stat) {\n    throw new Error(`File not found: ${migratePath}`)\n  }\n\n  if (stat.isFile()) {\n    return [resolvedPath]\n  }\n\n  if (stat.isDirectory()) {\n    const files = await findSourceFiles(resolvedPath)\n    if (!files.length) {\n      throw new Error(`No files found matching: ${migratePath}`)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/shadcn-ui/ui/blob/5c7072da672b0048bc6771e3204063a2537df91a/packages/shadcn/src/migrations/cn/files.ts#L14-L50","documentation":"The `cn` migration in shadcn CLI resolves the files to migrate via resolveMigrationFiles in packages/shadcn/src/migrations/cn/files.ts. When the user passes a glob `path` option, it runs fast-glob with that pattern against the project cwd; if the glob matches zero source files (after ignoring node_modules, dist, build, etc.), the migration aborts rather than silently doing nothing. This protects you from a typo in the glob pattern performing no work.","triggerScenarios":"Calling migrateCn({ cwd, path: '<glob>' }) (or `shadcn migrate cn --path <glob>`) where the pattern contains `*` but fast-glob returns an empty list — e.g. a wrong directory prefix, wrong extension, or all matches are excluded by SOURCE_IGNORE.","commonSituations":"Typing `src/**/*tsx` (missing the dot) instead of `src/**/*.tsx`; pointing the glob at `dist/` or `build/` which are ignored; running from the wrong cwd so a relative glob matches nothing; the project genuinely uses no js/ts files under the given glob.","solutions":["Fix the glob pattern to match actual source files, e.g. `src/**/*.tsx` instead of `src/**/*tsx`.","Verify you are running from the project root (cwd) that the glob is resolved against.","Test the pattern manually, e.g. `ls src/**/*.tsx` or a quick fast-glob snippet, to confirm it matches files.","Check the matches are not inside ignored directories (node_modules, dist, build, out, coverage, framework build dirs)."],"exampleFix":"// before\nawait migrateCn({ cwd: process.cwd(), path: 'app/**/*tsx' })\n// after\nawait migrateCn({ cwd: process.cwd(), path: 'app/**/*.tsx' })","handlingStrategy":"validation","validationCode":"import fg from 'fast-glob'\nconst matches = await fg('src/**/*.tsx', { cwd: process.cwd(), ignore: ['**/node_modules/**'] })\nif (!matches.length) throw new Error(`Glob matches no files: src/**/*.tsx`)\nawait migrateCn({ cwd: process.cwd(), path: 'src/**/*.tsx' })","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test glob patterns with ls or fast-glob before passing them to the migration.","Remember the CLI ignores node_modules, dist, build, out, coverage and framework dirs.","Run from the project root so relative globs resolve as expected."],"tags":["glob","file-not-found","cli"],"backgroundTag":"empty-result-set","analyzedSha":"5c7072da672b0048bc6771e3204063a2537df91a","analyzedAt":"2026-09-07T00:08:47.579Z","contentChangedAt":"2026-09-07T00:08:47.579Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}