shadcn-ui/ui · error · Error
No files found matching: ${migratePath}
Error message
No files found matching: ${migratePath} What it means
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.
Source
Thrown at packages/shadcn/src/migrations/cn/files.ts:32
"**/.svelte-kit/**",
"**/.astro/**",
"**/.output/**",
"**/.vercel/**",
"**/dist/**",
"**/build/**",
"**/out/**",
"**/coverage/**",
]
export async function resolveMigrationFiles(cwd: string, migratePath?: string) {
if (!migratePath) {
return findSourceFiles(cwd)
}
if (migratePath.includes("*")) {
const files = await findSourceFiles(cwd, migratePath)
if (!files.length) {
throw new Error(`No files found matching: ${migratePath}`)
}
return files
}
const resolvedPath = path.resolve(cwd, migratePath)
const stat = await fs.stat(resolvedPath).catch(() => null)
if (!stat) {
throw new Error(`File not found: ${migratePath}`)
}
if (stat.isFile()) {
return [resolvedPath]
}
if (stat.isDirectory()) {
const files = await findSourceFiles(resolvedPath)
if (!files.length) {
throw new Error(`No files found matching: ${migratePath}`)View on GitHub (pinned to 5c7072da67)
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).
Example fix
// before
await migrateCn({ cwd: process.cwd(), path: 'app/**/*tsx' })
// after
await migrateCn({ cwd: process.cwd(), path: 'app/**/*.tsx' }) Defensive patterns
Strategy: validation
Validate before calling
import fg from 'fast-glob'
const matches = await fg('src/**/*.tsx', { cwd: process.cwd(), ignore: ['**/node_modules/**'] })
if (!matches.length) throw new Error(`Glob matches no files: src/**/*.tsx`)
await migrateCn({ cwd: process.cwd(), path: 'src/**/*.tsx' }) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Failed to read config at ${options.cwd}.
- Missing value for --only. Use one or more of: ${APPLY_ONLY_V
- Invalid value for --only: ${value}. Use one or more of: ${AP
- Missing preset for --only. Use: shadcn apply <preset> --only
- Unknown client: ${client}. Available clients: ${CLIENTS.map(
AI-assisted analysis of shadcn-ui/ui@5c7072da67 (2026-09-07).
Data as JSON: /api/errors/cc3b3f741a54db23.
Report an issue: GitHub.