{"record":{"id":"ebffd9e50a1003e6","repo":"shadcn-ui/ui","slug":"you-cannot-migrate-to-the-same-icon-library-pleas","errorCode":null,"errorMessage":"You cannot migrate to the same icon library. Please choose a different icon library.","messagePattern":"You cannot migrate to the same icon library\\. Please choose a different icon library\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/migrations/migrate-icons.ts","lineNumber":178,"sourceCode":"        name: \"targetLibrary\",\n        message: `Which icon library would you like to ${highlighter.info(\n          \"migrate to\"\n        )}?`,\n        choices: libraryChoices,\n      },\n    ])\n\n    sourceLibraryName = sourceLibraryName ?? migrateOptions.sourceLibrary\n    targetLibraryName = targetLibraryName ?? migrateOptions.targetLibrary\n  }\n\n  if (!sourceLibraryName || !targetLibraryName) {\n    logger.info(\"Migration cancelled.\")\n    process.exit(0)\n  }\n\n  if (sourceLibraryName === targetLibraryName) {\n    throw new Error(\n      \"You cannot migrate to the same icon library. Please choose a different icon library.\"\n    )\n  }\n\n  const sourceLibrary =\n    MIGRATION_ICON_LIBRARIES[sourceLibraryName as MigrationIconLibraryName]\n  const targetLibrary =\n    MIGRATION_ICON_LIBRARIES[targetLibraryName as MigrationIconLibraryName]\n\n  if (!options.yes) {\n    const relativePath = options.path\n      ? options.path\n      : `./${path.relative(config.resolvedPaths.cwd, basePath)}`\n    const { confirm } = await prompts({\n      type: \"confirm\",\n      name: \"confirm\",\n      initial: true,\n      message: `We will migrate ${highlighter.info(","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/migrations/migrate-icons.ts#L160-L196","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nshadcn migrate icons --from lucide --to lucide\n\n// after\nshadcn migrate icons --from lucide --to radix","handlingStrategy":"validation","validationCode":"function assertDistinctLibraries(from?: string, to?: string) {\n  if (from && to && from === to) {\n    throw new Error('Source and target icon libraries must differ.')\n  }\n}\n\nassertDistinctLibraries(options.from, options.to)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["migration","icons","validation","user-input"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}