shadcn-ui/ui · error

No files found matching: ${options.path}

Error message

No files found matching: ${options.path}

What it means

Thrown by migrateIcons after fast-glob returns an empty array for a user-supplied --path. The path/glob was syntactically valid and resolved against config.resolvedPaths.cwd, but matched zero files. This is a preflight check before any icon migration work begins, ensuring the migration loop has targets.

Source

Thrown at packages/shadcn/src/migrations/migrate-icons.ts:103

        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}`)
    }
  } else {
    if (!config.resolvedPaths.ui) {
      throw new Error(
        "We could not find a valid `ui` path in your `components.json` file. Please ensure you have a valid `ui` path in your `components.json` file."
      )
    }

    basePath = config.resolvedPaths.ui
    files = await fg("**/*.{js,ts,jsx,tsx}", {
      cwd: basePath,
    })
  }

  const registryIcons = await getRegistryIcons()

  if (Object.keys(registryIcons).length === 0) {
    throw new Error("Something went wrong fetching the registry icons.")

View on GitHub (pinned to efac598707)

Solutions

  1. Verify the path/glob is relative to the project root (config.resolvedPaths.cwd), not an absolute path or relative to the ui directory.
  2. Run `ls <path>` or `find . -path './node_modules' -prune -o -name '*.tsx' -print` to confirm files exist and are not all under node_modules.
  3. If migrating non-JS extensions is intended, note the glob is hardcoded to '**/*.{js,ts,jsx,tsx}' for directories — point --path at specific files instead.
  4. Re-run from the project root or fix components.json `cwd` so resolvedPaths.cwd points where your source lives.

Example fix

// before
shadcn migrate icons --path ./src/components/**/*.vue

// after — point at files the migrator globs for, or pass explicit files
shadcn migrate icons --path ./src/components/button.tsx
shadcn migrate icons --path 'src/**/*.tsx'
Defensive patterns

Strategy: validation

Validate before calling

import fg from 'fast-glob'
import path from 'path'

async function assertPathHasFiles(input: string, cwd: string) {
  const isGlob = input.includes('*')
  let files: string[]
  if (isGlob) {
    files = await fg(input, { cwd, onlyFiles: true, ignore: ['**/node_modules/**'] })
  } else {
    const stat = await fs.stat(path.resolve(cwd, input)).catch(() => null)
    if (!stat) throw new Error(`File not found: ${input}`)
    files = stat.isDirectory()
      ? await fg('**/*.{js,ts,jsx,tsx}', { cwd: path.resolve(cwd, input), onlyFiles: true, ignore: ['**/node_modules/**'] })
      : [input]
  }
  if (files.length === 0) throw new Error(`No files found matching: ${input}`)
  return files
}

// call before migrateIcons({ path: input })
await assertPathHasFiles(options.path, config.resolvedPaths.cwd)

Type guard

function isValidPathInput(p: unknown): p is string {
  return typeof p === 'string' && p.length > 0 && !p.includes('\\x00')
}

Try / catch

try {
  await migrateIcons(config, { path: input, yes: true })
} catch (e) {
  if (e instanceof Error && e.message.startsWith('No files found matching:')) {
    logger.warn(`Skipping migration: ${e.message}`)
  } else {
    throw e
  }
}

Prevention

When it happens

Trigger: Running `shadcn migrate icons --path <glob-or-file>` where the value is a glob (contains '*') that fast-glob expands to nothing, or a directory containing no .js/.ts/.jsx/.tsx files. Also triggered when the path is a directory whose only matching files are excluded by the '**/node_modules/**' ignore rule.

Common situations: Typo in the glob pattern; pointing at a directory of .vue/.svelte files; running from the wrong working directory so config.resolvedPaths.cwd resolves outside the intended tree; passing a path that only matches files inside node_modules.

Related errors


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