{"record":{"id":"49f70efa59499d80","repo":"shadcn-ui/ui","slug":"unsupported-path-type-migratepath","errorCode":null,"errorMessage":"Unsupported path type: ${migratePath}","messagePattern":"Unsupported path type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/cn/files.ts","lineNumber":55,"sourceCode":"  const resolvedPath = path.resolve(cwd, migratePath)\n  const stat = await fs.stat(resolvedPath).catch(() => null)\n  if (!stat) {\n    throw new Error(`File not found: ${migratePath}`)\n  }\n\n  if (stat.isFile()) {\n    return [resolvedPath]\n  }\n\n  if (stat.isDirectory()) {\n    const files = await findSourceFiles(resolvedPath)\n    if (!files.length) {\n      throw new Error(`No files found matching: ${migratePath}`)\n    }\n    return files\n  }\n\n  throw new Error(`Unsupported path type: ${migratePath}`)\n}\n\nfunction findSourceFiles(cwd: string, pattern = SOURCE_PATTERN) {\n  return fg(pattern, {\n    cwd,\n    absolute: true,\n    onlyFiles: true,\n    ignore: SOURCE_IGNORE,\n    suppressErrors: true,\n    dot: true,\n  })\n}\n\nexport function getScriptRegions(content: string, filename: string) {\n  const regions: SourceRegion[] = []\n  const pattern = /<script\\b([^>]*)>([\\s\\S]*?)<\\/script(?:\\s[^>]*)?>/gi\n  let match: RegExpExecArray | null\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/shadcn-ui/ui/blob/5c7072da672b0048bc6771e3204063a2537df91a/packages/shadcn/src/migrations/cn/files.ts#L37-L73","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a regular source file, directory, or glob instead of the special file.","Check what the path is with `stat <path>`; replace devices/sockets/FIFOs with real source paths.","Omit --path to let the CLI discover all source files from the project root."],"exampleFix":"// before\nawait migrateCn({ cwd: process.cwd(), path: '/dev/null' })\n// after\nawait migrateCn({ cwd: process.cwd(), path: 'src/**/*.tsx' })","handlingStrategy":"validation","validationCode":"import { statSync } from 'fs'\nconst s = statSync('/dev/null')\nif (!s.isFile() && !s.isDirectory()) throw new Error('Path must be a regular file or directory')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass device/pipe/socket paths to file-migration tools.","Stat the path first if it comes from user input or environment variables."],"tags":["filesystem","path","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"5c7072da672b0048bc6771e3204063a2537df91a","analyzedAt":"2026-09-07T00:08:47.579Z","contentChangedAt":"2026-09-07T00:08:47.579Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}