shadcn-ui/ui · error
You cannot migrate to the same icon library. Please choose a
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.
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)
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: ${libraryName}. Available libraries: $
- No files found matching: ${options.path}
- Base "${config.base}" or icon library "${config.iconLibrary}
- Missing value for --only. Use one or more of: ${APPLY_ONLY_V
- Invalid value for --only: ${value}. Use one or more of: ${AP
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/ebffd9e50a1003e6.
Report an issue: GitHub.