{"record":{"id":"37dd727d97c99bd7","repo":"shadcn-ui/ui","slug":"you-must-specify-a-migration-run-shadcn-migrate","errorCode":null,"errorMessage":"You must specify a migration. Run `shadcn migrate --list` to see available migrations.","messagePattern":"You must specify a migration\\. Run `shadcn migrate --list` to see available migrations\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/shadcn/src/commands/migrate.ts","lineNumber":88,"sourceCode":"        cwd: path.resolve(opts.cwd),\n        migration,\n        path: migratePath,\n        list: opts.list,\n        yes: opts.yes,\n        from: opts.from,\n        to: opts.to,\n      })\n\n      if (options.list || !options.migration) {\n        logger.info(\"Available migrations:\")\n        for (const migration of migrations) {\n          logger.info(`- ${migration.name}: ${migration.description}`)\n        }\n        return\n      }\n\n      if (!options.migration) {\n        throw new Error(\n          \"You must specify a migration. Run `shadcn migrate --list` to see available migrations.\"\n        )\n      }\n\n      let { errors, config } = await preFlightMigrate(options)\n\n      if (\n        errors[ERRORS.MISSING_DIR_OR_EMPTY_PROJECT] ||\n        errors[ERRORS.MISSING_CONFIG]\n      ) {\n        throw new Error(\n          \"No `components.json` file found. Ensure you are at the root of your project.\"\n        )\n      }\n\n      if (!config) {\n        throw new Error(\n          \"Something went wrong reading your `components.json` file. Please ensure you have a valid `components.json` file.\"","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/commands/migrate.ts#L70-L106","documentation":"Defensive guard intended to ensure a migration name was supplied. Note: the early-return at migrate.ts:79 already lists and returns when --list is set OR options.migration is falsy, so control only reaches line 87 when options.migration is already truthy. Under the current flow this branch is effectively dead code — kept as a safety net.","triggerScenarios":"Not reachable through the CLI in current versions. Would only fire if the line-79 short-circuit were removed or its condition changed in a future refactor.","commonSituations":"Not user-reachable today; relevant only to maintainers refactoring the migrate command dispatcher.","solutions":["Pass a migration name: `shadcn migrate icons` (or radix, rtl).","Run `shadcn migrate --list` to see valid names.","If maintaining this code, reconcile lines 79 and 87 to remove the redundant check."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// The early-return at migrate.ts:79 already handles the falsy case.\n// If you refactor that, keep an explicit guard:\nif (!options.migration && !options.list) {\n  throw new Error(\"You must specify a migration. Run `shadcn migrate --list`.\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass --list to discover valid migration names before invoking one.","Reconcile the redundant guards at lines 79 and 87 if refactoring."],"tags":["migrate","validation","dead-code"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}