{"record":{"id":"3687e88e0c045bb8","repo":"angular/angular-cli","slug":"a-single-package-must-be-specified-when-using-the","errorCode":null,"errorMessage":"A single package must be specified when using the 'migrate-only' option.","messagePattern":"A single package must be specified when using the 'migrate-only' option\\.","errorType":"validation","errorClass":"CommandModuleError","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/update/cli.ts","lineNumber":154,"sourceCode":"      .check(({ packages, 'allow-dirty': allowDirty, 'migrate-only': migrateOnly }) => {\n        const { logger } = this.context;\n\n        // This allows the user to easily reset any changes from the update.\n        if (packages?.length && !checkCleanGit(this.context.root)) {\n          if (allowDirty) {\n            logger.warn(\n              'Repository is not clean. Update changes will be mixed with pre-existing changes.',\n            );\n          } else {\n            throw new CommandModuleError(\n              'Repository is not clean. Please commit or stash any changes before updating.',\n            );\n          }\n        }\n\n        if (migrateOnly) {\n          if (packages?.length !== 1) {\n            throw new CommandModuleError(\n              `A single package must be specified when using the 'migrate-only' option.`,\n            );\n          }\n        }\n\n        return true;\n      })\n      .strict();\n  }\n\n  async run(options: Options<UpdateCommandArgs>): Promise<number | void> {\n    const { logger, packageManager } = this.context;\n\n    // Check if the current installed CLI version is older than the latest compatible version.\n    // Skip when running `ng update` without a package name as this will not trigger an actual update.\n    if (!disableVersionCheck && options.packages?.length) {\n      const cliVersionToInstall = await checkCLIVersion(\n        options.packages,","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/update/cli.ts#L136-L172","documentation":"When --migrate-only is used, the update command requires exactly one package name, because migration runs the specified package's migration scripts only. Passing zero or multiple packages is ambiguous and rejected with a CommandModuleError.","triggerScenarios":"`ng update --migrate-only` with no package; `ng update pkg1 pkg2 --migrate-only` with multiple packages; combining --migrate-only with --all semantics.","commonSituations":"Copy-pasting multi-package update commands and appending --migrate-only; forgetting the package name when running only migrations.","solutions":["Specify exactly one package: `ng update @angular/core --migrate-only` (optionally with --from/--to).","If you intended a full update of several packages, drop --migrate-only.","Run one `ng update <pkg> --migrate-only` per package that has migrations."],"exampleFix":"// before\nng update --migrate-only\n// after\nng update @angular/material --migrate-only --from 15 --to 16","handlingStrategy":"validation","validationCode":"if (migrateOnly && packages.length !== 1) {\n  throw new Error(`--migrate-only requires exactly one package, got: ${packages.length}`);\n}","typeGuard":"function isSinglePackage(args: { packages?: string[]; migrateOnly?: boolean }): boolean {\n  return !args.migrateOnly || args.packages?.length === 1;\n}","tryCatchPattern":null,"preventionTips":["Loop over packages in scripts: for each pkg, run `ng update pkg --migrate-only`.","Remember --migrate-only means 'run migrations for one package', not a bulk update."],"tags":["angular","cli","update","invalid-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}