shadcn-ui/ui · error · Error

Unsupported path type: ${migratePath}

Error message

Unsupported path type: ${migratePath}

What it means

After resolving the user-supplied `path`, if it is neither a file nor a directory (e.g. a socket, FIFO, symlink chain to a special file, or device node), resolveMigrationFiles has no way to enumerate files from it and throws `Unsupported path type`. It is a defensive terminal branch after the isFile/isDirectory checks both fail.

Source

Thrown at packages/shadcn/src/migrations/cn/files.ts:55

  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}`)
    }
    return files
  }

  throw new Error(`Unsupported path type: ${migratePath}`)
}

function findSourceFiles(cwd: string, pattern = SOURCE_PATTERN) {
  return fg(pattern, {
    cwd,
    absolute: true,
    onlyFiles: true,
    ignore: SOURCE_IGNORE,
    suppressErrors: true,
    dot: true,
  })
}

export function getScriptRegions(content: string, filename: string) {
  const regions: SourceRegion[] = []
  const pattern = /<script\b([^>]*)>([\s\S]*?)<\/script(?:\s[^>]*)?>/gi
  let match: RegExpExecArray | null

View on GitHub (pinned to 5c7072da67)

Solutions

  1. Pass a regular source file, directory, or glob instead of the special file.
  2. Check what the path is with `stat <path>`; replace devices/sockets/FIFOs with real source paths.
  3. Omit --path to let the CLI discover all source files from the project root.

Example fix

// before
await migrateCn({ cwd: process.cwd(), path: '/dev/null' })
// after
await migrateCn({ cwd: process.cwd(), path: 'src/**/*.tsx' })
Defensive patterns

Strategy: validation

Validate before calling

import { statSync } from 'fs'
const s = statSync('/dev/null')
if (!s.isFile() && !s.isDirectory()) throw new Error('Path must be a regular file or directory')

Prevention

When it happens

Trigger: migrateCn({ cwd, path: X }) where X exists on disk but stat reports it as neither file nor directory — character/block devices, FIFOs, sockets, or broken special files.

Common situations: Accidentally passing a device path like /dev/null or /dev/stdin, a Unix socket file, or a named pipe; extremely rare in normal project usage.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of shadcn-ui/ui@5c7072da67 (2026-09-07). Data as JSON: /api/errors/49f70efa59499d80. Report an issue: GitHub.