{"record":{"id":"394792ebb17c5e66","repo":"shadcn-ui/ui","slug":"file-not-found-options-path-394792","errorCode":null,"errorMessage":"File not found: ${options.path}","messagePattern":"File not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-radix.ts","lineNumber":125,"sourceCode":"  let basePath: string\n\n  if (options.path) {\n    // User provided a path/glob.\n    basePath = config.resolvedPaths.cwd\n    const isGlob = options.path.includes(\"*\")\n\n    if (isGlob) {\n      files = await fg(options.path, {\n        cwd: basePath,\n        onlyFiles: true,\n        ignore: [\"**/node_modules/**\"],\n      })\n    } else {\n      const fullPath = path.resolve(basePath, options.path)\n      const stat = await fs.stat(fullPath).catch(() => null)\n\n      if (!stat) {\n        throw new Error(`File not found: ${options.path}`)\n      }\n\n      if (stat.isDirectory()) {\n        basePath = fullPath\n        files = await fg(\"**/*.{js,ts,jsx,tsx}\", {\n          cwd: basePath,\n          onlyFiles: true,\n          ignore: [\"**/node_modules/**\"],\n        })\n      } else if (stat.isFile()) {\n        files = [options.path]\n      } else {\n        throw new Error(`Unsupported path type: ${options.path}`)\n      }\n    }\n\n    if (files.length === 0) {\n      throw new Error(`No files found matching: ${options.path}`)","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/migrations/migrate-radix.ts#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"Wrong terminal working directory; path copied from a different machine/layout; case-sensitivity mismatch on case-sensitive filesystems.","solutions":["Confirm the file exists: `ls <config.resolvedPaths.cwd>/<options.path>`.","Check the working directory matches the project root set in components.json.","On Linux, verify the path's case exactly matches the filesystem."],"exampleFix":"// before\nshadcn migrate radix --path ./src/componets/ui/button.tsx\n\n// after — fix the typo / verify path\nshadcn migrate radix --path ./src/components/ui/button.tsx","handlingStrategy":"validation","validationCode":"import fs from 'fs/promises'\nimport path from 'path'\n\nasync function assertFileExists(rel: string, cwd: string) {\n  const full = path.resolve(cwd, rel)\n  const stat = await fs.stat(full).catch(() => null)\n  if (!stat) throw new Error(`File not found: ${rel}`)\n  return full\n}\n\nawait assertFileExists(options.path, config.resolvedPaths.cwd)","typeGuard":null,"tryCatchPattern":"try {\n  await migrateRadix(config, { path: rel, yes: true })\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('File not found:')) {\n    // log and skip, or fall back to a glob\n  } else throw e\n}","preventionTips":["Resolve paths against config.resolvedPaths.cwd, not process.cwd().","Validate paths from CLI args with a quick fs.stat before dispatching.","On case-sensitive filesystems, normalize case against a directory listing."],"tags":["migration","radix","filesystem","path-resolution","user-input"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}