{"record":{"id":"a91687b03540e9f7","repo":"shadcn-ui/ui","slug":"could-not-find-a-valid-ui-path-in-your-componen","errorCode":null,"errorMessage":"Could not find a valid `ui` path in your `components.json`. Please provide a path or glob pattern.","messagePattern":"Could not find a valid `ui` path in your `components\\.json`\\. Please provide a path or glob pattern\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-rtl.ts","lineNumber":68,"sourceCode":"        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}`)\n    }\n  } else {\n    // Default: use ui path from components.json.\n    if (!config.resolvedPaths.ui) {\n      throw new Error(\n        \"Could not find a valid `ui` path in your `components.json`. Please provide a path or glob pattern.\"\n      )\n    }\n\n    basePath = config.resolvedPaths.ui\n    files = await fg(\"**/*.{js,ts,jsx,tsx}\", {\n      cwd: basePath,\n      onlyFiles: true,\n    })\n  }\n\n  // Confirm with user.\n  if (!options.yes) {\n    const relativePath = options.path\n      ? options.path\n      : `./${path.relative(config.resolvedPaths.cwd, basePath)}`\n\n    const { confirm } = await prompts({","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/migrations/migrate-rtl.ts#L50-L86","documentation":"Thrown by migrateRtl when no --path was given and config.resolvedPaths.ui is falsy. Unlike the icons/radix variants, this message also suggests providing a path or glob pattern as an alternative to fixing components.json. Without a ui path or explicit path the RTL migrator has no file set.","triggerScenarios":"Running `shadcn migrate rtl` (no --path) on a project lacking `aliases.ui`; programmatic call with a Config missing resolvedPaths.ui.","commonSituations":"components.json missing the ui alias; project never initialized; partial programmatic Config.","solutions":["Provide `--path` to bypass the ui-path fallback.","Add `aliases.ui` to components.json.","Re-run `npx shadcn@latest init`.","Programmatic callers: resolve Config via get-config first."],"exampleFix":"// before\nshadcn migrate rtl\n// (components.json has no aliases.ui)\n\n// after — either pass a path\nshadcn migrate rtl --path ./src/components/ui\n// or add to components.json:\n\"aliases\": { \"components\": \"@/components\", \"ui\": \"@/components/ui\" }","handlingStrategy":"validation","validationCode":"function assertUiPathOrExplicit(config: Config, path?: string) {\n  if (!path && !config.resolvedPaths.ui) {\n    throw new Error('Provide --path or set aliases.ui in components.json before running RTL migration.')\n  }\n}\n\nassertUiPathOrExplicit(config, options.path)","typeGuard":"function hasUiPath(c: Partial<Config>): c is Config & { resolvedPaths: { ui: string } } {\n  return Boolean(c.resolvedPaths?.ui)\n}","tryCatchPattern":"try {\n  await migrateRtl(config)\n} catch (e) {\n  if (e instanceof Error && e.message.includes('valid `ui` path')) {\n    await migrateRtl(config, { path: './src/components/ui' })\n  } else throw e\n}","preventionTips":["Always pass --path in automation to avoid depending on components.json aliases.","Run `shadcn init` after restructuring to refresh aliases.","Programmatic callers: resolve Config via get-config first."],"tags":["migration","rtl","config","components-json","path-resolution"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}