shadcn-ui/ui · error
File not found
Error message
File not found: ${options.path} What it means
Thrown by migrateRadix when a non-glob --path is given but fs.stat resolves to null (the catch returns null). This means the path does not exist on disk under config.resolvedPaths.cwd. The check happens before any directory traversal, so no migration work is attempted on a missing target.
Solutions
- Confirm the file exists: `ls <config.resolvedPaths.cwd>/<options.path>`.
- Check the working directory matches the project root set in components.json.
- On Linux, verify the path's case exactly matches the filesystem.
Example fix
// before shadcn migrate radix --path ./src/componets/ui/button.tsx // after — fix the typo / verify path shadcn migrate radix --path ./src/components/ui/button.tsx
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs/promises'
import path from 'path'
async function assertFileExists(rel: string, cwd: string) {
const full = path.resolve(cwd, rel)
const stat = await fs.stat(full).catch(() => null)
if (!stat) throw new Error(`File not found: ${rel}`)
return full
}
await assertFileExists(options.path, config.resolvedPaths.cwd) Try / catch
try {
await migrateRadix(config, { path: rel, yes: true })
} catch (e) {
if (e instanceof Error && e.message.startsWith('File not found:')) {
// log and skip, or fall back to a glob
} else throw e
} Prevention
- Resolve paths against config.resolvedPaths.cwd, not process.cwd().
- Validate paths from CLI args with a quick fs.stat before dispatching.
- On case-sensitive filesystems, normalize case against a directory listing.
When it happens
Trigger: Running `shadcn migrate radix --path ./src/missing.tsx`; relative path that resolves against an unexpected cwd; typo in the filename; the file was deleted between the user typing the command and pressing enter.
Common situations: Wrong terminal working directory; path copied from a different machine/layout; case-sensitivity mismatch on case-sensitive filesystems.
Related errors
- File not found
- No files found matching
- Unsupported path type
- No files found matching
- No files found matching
AI-assisted analysis of shadcn-ui/ui@c06da1d0e9 (2026-08-12).
Data as JSON: /api/errors/394792ebb17c5e66.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shadcn/src/migrations/migrate-radix.ts:126
if (options.path) {
// User provided a path/glob.
basePath = config.resolvedPaths.cwd
const isGlob = options.path.includes("*")
if (isGlob) {
files = await fg(options.path, {
cwd: basePath,
onlyFiles: true,
ignore: ["**/node_modules/**"],
suppressErrors: true,
})
} else {
const fullPath = path.resolve(basePath, options.path)
const stat = await fs.stat(fullPath).catch(() => null)
if (!stat) {
throw new Error(`File not found: ${options.path}`)
}
if (stat.isDirectory()) {
basePath = fullPath
files = await fg("**/*.{js,ts,jsx,tsx}", {
cwd: basePath,
onlyFiles: true,
ignore: ["**/node_modules/**"],
suppressErrors: true,
})
} else if (stat.isFile()) {
files = [options.path]
} else {
throw new Error(`Unsupported path type: ${options.path}`)
}
}
if (files.length === 0) {View on GitHub (pinned to c06da1d0e9)