{"record":{"id":"bbaa895dcc00bc9d","repo":"shadcn-ui/ui","slug":"we-could-not-find-a-valid-ui-path-in-your-compo-bbaa89","errorCode":null,"errorMessage":"We could not find a valid `ui` path in your `components.json` file. Please ensure you have a valid `ui` path in your `components.json` file.","messagePattern":"We could not find a valid `ui` path in your `components\\.json` file\\. Please ensure you have a valid `ui` path in your `components\\.json` file\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-radix.ts","lineNumber":148,"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        \"We could not find a valid `ui` path in your `components.json` file. Please ensure you have a valid `ui` path in your `components.json` file.\"\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":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/migrations/migrate-radix.ts#L130-L166","documentation":"Thrown by migrateRadix when no --path was given and config.resolvedPaths.ui is falsy. The default behavior is to scan the configured `ui` directory; without it the migrator has no fallback. The message instructs the user to fix components.json.","triggerScenarios":"Running `shadcn migrate radix` (no --path) on a project whose components.json lacks `aliases.ui`; programmatic call to migrateRadix with a Config missing resolvedPaths.ui.","commonSituations":"Hand-edited components.json with the `ui` alias removed; project never ran `shadcn init`; partial Config built programmatically without resolving aliases.","solutions":["Add `aliases.ui` to components.json (e.g. \"@/components/ui\").","Re-run `npx shadcn@latest init`.","Pass `--path` to bypass the ui-path fallback.","Programmatic callers: resolve Config via get-config before calling migrateRadix."],"exampleFix":"// before — components.json without aliases.ui\n\"aliases\": { \"components\": \"@/components\" }\n\n// after\n\"aliases\": { \"components\": \"@/components\", \"ui\": \"@/components/ui\" }","handlingStrategy":"validation","validationCode":"function assertUiPathForRadix(config: Config) {\n  if (!config.resolvedPaths.ui) {\n    throw new Error('Run `npx shadcn@latest init` to set aliases.ui, or pass --path.')\n  }\n}\n\nif (!options.path) assertUiPathForRadix(config)","typeGuard":"function hasUiPath(c: Partial<Config>): c is Config & { resolvedPaths: { ui: string } } {\n  return Boolean(c.resolvedPaths?.ui)\n}","tryCatchPattern":"try {\n  await migrateRadix(config)\n} catch (e) {\n  if (e instanceof Error && e.message.includes('valid `ui` path')) {\n    await migrateRadix(config, { path: './src/components/ui' })\n  } else throw e\n}","preventionTips":["Keep components.json's aliases complete and under source control.","Programmatic callers: resolve Config via get-config first.","Default to passing --path in automation to avoid depending on aliases."],"tags":["migration","radix","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"}