shadcn-ui/ui · error
Unknown icon library: ${libraryName}. Available libraries: $
Error message
Unknown icon library: ${libraryName}. Available libraries: ${Object.keys(MIGRATION_ICON_LIBRARIES).join(", ")}. What it means
Thrown during validation of --from/--to flags when either value is truthy but not a key of MIGRATION_ICON_LIBRARIES. The migrator only knows a fixed set of libraries (the bundled iconLibraries plus `radix`), and this guard rejects unknown names early before any prompting or file scanning side effects. The message lists the accepted names.
Source
Thrown at packages/shadcn/src/migrations/migrate-icons.ts:133
})
}
const registryIcons = await getRegistryIcons()
if (Object.keys(registryIcons).length === 0) {
throw new Error("Something went wrong fetching the registry icons.")
}
const libraryChoices = Object.entries(MIGRATION_ICON_LIBRARIES).map(
([name, iconLibrary]) => ({
title: iconLibrary.title,
value: name,
})
)
for (const libraryName of [options.from, options.to]) {
if (libraryName && !(libraryName in MIGRATION_ICON_LIBRARIES)) {
throw new Error(
`Unknown icon library: ${libraryName}. Available libraries: ${Object.keys(
MIGRATION_ICON_LIBRARIES
).join(", ")}.`
)
}
}
let sourceLibraryName = options.from
let targetLibraryName = options.to
if (!sourceLibraryName || !targetLibraryName) {
const currentLibraryIndex = libraryChoices.findIndex(
(choice) => choice.value === config.iconLibrary
)
const migrateOptions = await prompts([
{
type: sourceLibraryName ? null : "select",
name: "sourceLibrary",View on GitHub (pinned to efac598707)
Solutions
- Run without --from/--to to see the interactive picker, which only lists valid libraries.
- Check the message's 'Available libraries:' list and use one of those exact strings.
- Upgrade shadcn to a version that includes the desired library in MIGRATION_ICON_LIBRARIES.
- If the library is genuinely unsupported, migrate manually or open a feature request.
Example fix
// before shadcn migrate icons --from lucide --to heroicons // after — use a supported library name shadcn migrate icons --from lucide --to radix
Defensive patterns
Strategy: type-guard
Validate before calling
import { MIGRATION_ICON_LIBRARIES } from '@/src/migrations/migrate-icons'
function assertValidLibraryFlags(from?: string, to?: string) {
const valid = Object.keys(MIGRATION_ICON_LIBRARIES)
for (const name of [from, to]) {
if (name && !(name in MIGRATION_ICON_LIBRARIES)) {
throw new Error(`Unknown icon library: ${name}. Available: ${valid.join(', ')}`)
}
}
}
assertValidLibraryFlags(options.from, options.to) Type guard
import type { MigrationIconLibraryName } from '@/src/migrations/migrate-icons'
function isMigrationLibraryName(name: string): name is MigrationIconLibraryName {
return name in MIGRATION_ICON_LIBRARIES
} Prevention
- Surface library choices to users via a dropdown of Object.keys(MIGRATION_ICON_LIBRARIES).
- In CI scripts, derive library names from a constant shared with the migrator.
- Upgrade shadcn before assuming a newly-released library is supported.
When it happens
Trigger: Running `shadcn migrate icons --from lucide --to heroicons` where `heroicons` is not in MIGRATION_ICON_LIBRARIES; passing a typo like `--from lucid`; passing a library name that exists in iconLibraries docs but was added after this version of shadcn.
Common situations: User assumes a library is supported because they installed it; version skew — older shadcn does not know about a library added in a newer release; typo in CI script variable.
Related errors
- You cannot migrate to the same icon library. Please choose a
- No files found matching: ${options.path}
- We could not find a valid `ui` path in your `components.json
- Could not resolve the icon import for ${sourceLibrary.title}
- Base "${config.base}" or icon library "${config.iconLibrary}
AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12).
Data as JSON: /api/errors/0064927577e5a1d8.
Report an issue: GitHub.