shadcn-ui/ui · error
File not found: ${options.path}
Error message
File not found: ${options.path} What it means
Thrown by migrateRtl when a non-glob --path resolves to no filesystem entry (fs.stat returns null). Identical guard to migrate-radix's 'File not found' check, applied before any RTL transform work. The migrator will not attempt to read a non-existent file.
Source
Thrown at packages/shadcn/src/migrations/migrate-rtl.ts:45
let basePath: string
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/**"],
})
} 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/**"],
})
} else if (stat.isFile()) {
files = [options.path]
} else {
throw new Error(`Unsupported path type: ${options.path}`)
}
}
if (files.length === 0) {
throw new Error(`No files found matching: ${options.path}`)View on GitHub (pinned to efac598707)
Solutions
- Verify the file exists under config.resolvedPaths.cwd.
- Check terminal cwd matches the project root.
- On Linux, verify exact case of the path.
Example fix
// before shadcn migrate rtl --path ./src/componets/ui/sidebar.tsx // after shadcn migrate rtl --path ./src/components/ui/sidebar.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 stat = await fs.stat(path.resolve(cwd, rel)).catch(() => null)
if (!stat) throw new Error(`File not found: ${rel}`)
}
await assertFileExists(options.path, config.resolvedPaths.cwd) Try / catch
try {
await migrateRtl(config, { path: rel, yes: true })
} catch (e) {
if (e instanceof Error && e.message.startsWith('File not found:')) {
logger.warn(`Skipping RTL migration for missing path: ${rel}`)
} else throw e
} Prevention
- Validate CLI-provided paths with fs.stat before dispatching.
- Resolve against config.resolvedPaths.cwd, not process.cwd().
- On case-sensitive filesystems, verify exact case.
When it happens
Trigger: Running `shadcn migrate rtl --path ./missing.tsx`; relative path resolved against an unexpected cwd; typo; file removed before the command ran.
Common situations: Wrong working directory; stale path from a renamed file; case mismatch on case-sensitive filesystems.
Related errors
- File not found: ${options.path}
- Unsupported path type: ${options.path}
- No files found matching: ${options.path}
- No files found matching: ${options.path}
- Unsupported path type: ${options.path}
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/0fb15a2b29aafee8.
Report an issue: GitHub.