{"record":{"id":"0fb15a2b29aafee8","repo":"shadcn-ui/ui","slug":"file-not-found-options-path-0fb15a","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-rtl.ts","lineNumber":45,"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":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/migrations/migrate-rtl.ts#L27-L63","documentation":"Thrown by migrateRtl when a non-glob --path resolves to no filesystem entry (fs.stat returns null). Identical guard to migrate-radix's 'File not found' check, applied before any RTL transform work. The migrator will not attempt to read a non-existent file.","triggerScenarios":"Running `shadcn migrate rtl --path ./missing.tsx`; relative path resolved against an unexpected cwd; typo; file removed before the command ran.","commonSituations":"Wrong working directory; stale path from a renamed file; case mismatch on case-sensitive filesystems.","solutions":["Verify the file exists under config.resolvedPaths.cwd.","Check terminal cwd matches the project root.","On Linux, verify exact case of the path."],"exampleFix":"// before\nshadcn migrate rtl --path ./src/componets/ui/sidebar.tsx\n\n// after\nshadcn migrate rtl --path ./src/components/ui/sidebar.tsx","handlingStrategy":"validation","validationCode":"import fs from 'fs/promises'\nimport path from 'path'\n\nasync function assertFileExists(rel: string, cwd: string) {\n  const stat = await fs.stat(path.resolve(cwd, rel)).catch(() => null)\n  if (!stat) throw new Error(`File not found: ${rel}`)\n}\n\nawait assertFileExists(options.path, config.resolvedPaths.cwd)","typeGuard":null,"tryCatchPattern":"try {\n  await migrateRtl(config, { path: rel, yes: true })\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('File not found:')) {\n    logger.warn(`Skipping RTL migration for missing path: ${rel}`)\n  } else throw e\n}","preventionTips":["Validate CLI-provided paths with fs.stat before dispatching.","Resolve against config.resolvedPaths.cwd, not process.cwd().","On case-sensitive filesystems, verify exact case."],"tags":["migration","rtl","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"}