{"record":{"id":"597d48f94bf639e2","repo":"yarnpkg/yarn","slug":"noarguments","errorCode":null,"errorMessage":"noArguments","messagePattern":"noArguments","errorType":"exception","errorClass":"MessageError","httpStatus":null,"severity":"error","filePath":"src/cli/commands/unplug.js","lineNumber":33,"sourceCode":"\nexport function setFlags(commander: Object) {\n  commander.description(\n    'Temporarily copies a package (with an optional @range suffix) outside of the global cache for debugging purposes',\n  );\n  commander.usage('unplug [packages ...] [flags]');\n  commander.option('--clear', 'Delete the selected packages');\n  commander.option('--clear-all', 'Delete all unplugged packages');\n}\n\nexport async function run(config: Config, reporter: Reporter, flags: Object, args: Array<string>): Promise<void> {\n  if (!config.plugnplayEnabled) {\n    throw new MessageError(reporter.lang('unplugDisabled'));\n  }\n  if (!args.length && flags.clear) {\n    throw new MessageError(reporter.lang('tooFewArguments', 1));\n  }\n  if (args.length && flags.clearAll) {\n    throw new MessageError(reporter.lang('noArguments'));\n  }\n\n  if (flags.clearAll) {\n    await clearAll(config);\n  } else if (flags.clear) {\n    await clearSome(config, new Set(args));\n  } else if (args.length > 0) {\n    const lockfile = await Lockfile.fromDirectory(config.lockfileFolder, reporter);\n    await wrapLifecycle(config, flags, async () => {\n      const install = new Install(flags, config, reporter, lockfile);\n      install.linker.unplugged = args;\n      await install.init();\n    });\n  }\n\n  const unpluggedPackageFolders = await config.listUnpluggedPackageFolders();\n\n  for (const target of unpluggedPackageFolders.values()) {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/cli/commands/unplug.js#L15-L51","documentation":"Thrown by 'yarn unplug' when --clear-all is supplied together with positional args. --clear-all already targets every unplugged package, so naming specific packages is contradictory and rejected.","triggerScenarios":"Running 'yarn unplug --clear-all <pkg>' where args.length > 0, so the condition (args.length && flags.clearAll) is true.","commonSituations":"User mixed flags (copied --clear syntax then switched to --clear-all); habit of always naming packages.","solutions":["Drop the package args: 'yarn unplug --clear-all'.","If you want to clear only specific packages, use '--clear <pkg>...' instead of '--clear-all'."],"exampleFix":"# before\n$ yarn unplug --clear-all lodash\n# after\n$ yarn unplug --clear-all","handlingStrategy":"validation","validationCode":"if (flags.clearAll && Array.isArray(args) && args.length > 0) {\n  throw new Error(\"'--clear-all' takes no package args; remove them or use '--clear <pkgs>'.\");\n}","typeGuard":"function clearAllIsClean(flags: Object, args: string[]): boolean {\n  return Boolean(flags.clearAll) && args.length === 0;\n}","tryCatchPattern":null,"preventionTips":["Make wrapper scripts mutually-exclusive on --clear vs --clear-all.","Document the two clear modes side by side to avoid confusion."],"tags":["cli-args","validation","plugnplay"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}