shadcn-ui/ui · error

File not found: ${options.path}

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.

Source

Thrown at packages/shadcn/src/migrations/migrate-radix.ts:125

  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

  1. Confirm the file exists: `ls <config.resolvedPaths.cwd>/<options.path>`.
  2. Check the working directory matches the project root set in components.json.
  3. 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

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


AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12). Data as JSON: /api/errors/394792ebb17c5e66. Report an issue: GitHub.