shadcn-ui/ui · error
You cannot migrate to the same icon library. Please choose…
Error message
You cannot migrate to the same icon library. Please choose a different icon library.
What it means
Thrown after source and target libraries are resolved (via flags or interactive prompts) when they are identical. Migrating a library to itself is a no-op and would only rewrite identical imports, so the migrator refuses rather than churn files. This runs after the cancellation exit, so it only fires for confirmed runs.
Solutions
- Choose a different target library for --to.
- If the goal was a no-op refresh, skip migration entirely — no rewrite is needed.
- In scripts, guard before invocation: only run when from !== to.
Example fix
// before shadcn migrate icons --from lucide --to lucide // after shadcn migrate icons --from lucide --to radix
Defensive patterns
Strategy: validation
Validate before calling
function assertDistinctLibraries(from?: string, to?: string) {
if (from && to && from === to) {
throw new Error('Source and target icon libraries must differ.')
}
}
assertDistinctLibraries(options.from, options.to) Prevention
- In CI, compute --to as a function of --from and reject equality up front.
- When prompting, filter the target list to exclude the chosen source.
- Treat same-library 'migration' as a no-op and skip the command entirely.
When it happens
Trigger: Passing `--from lucide --to lucide`; in the interactive prompt selecting the same library for both 'migrate from' and 'migrate to'; a CI script that derives --to from the current config.iconLibrary and accidentally targets the same library.
Common situations: Copy-pasted CI command where --from and --to were not updated; user exploring the prompt and choosing the default for both; script computing target from config without excluding the source.
Related errors
- Unknown icon library
- No files found matching
- Base " " or icon library " " not found
- Could not resolve the icon import for
- File not found
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/ebffd9e50a1003e6.
Report an issue: GitHub.
Appendix: source
Thrown at packages/shadcn/src/migrations/migrate-icons.ts:178
name: "targetLibrary",
message: `Which icon library would you like to ${highlighter.info(
"migrate to"
)}?`,
choices: libraryChoices,
},
])
sourceLibraryName = sourceLibraryName ?? migrateOptions.sourceLibrary
targetLibraryName = targetLibraryName ?? migrateOptions.targetLibrary
}
if (!sourceLibraryName || !targetLibraryName) {
logger.info("Migration cancelled.")
process.exit(0)
}
if (sourceLibraryName === targetLibraryName) {
throw new Error(
"You cannot migrate to the same icon library. Please choose a different icon library."
)
}
const sourceLibrary =
MIGRATION_ICON_LIBRARIES[sourceLibraryName as MigrationIconLibraryName]
const targetLibrary =
MIGRATION_ICON_LIBRARIES[targetLibraryName as MigrationIconLibraryName]
if (!options.yes) {
const relativePath = options.path
? options.path
: `./${path.relative(config.resolvedPaths.cwd, basePath)}`
const { confirm } = await prompts({
type: "confirm",
name: "confirm",
initial: true,
message: `We will migrate ${highlighter.info(View on GitHub (pinned to efac598707)