{"record":{"id":"5de3bbaa146a6ceb","repo":"phacility/phabricator","slug":"you-can-not-specify-both-id-and-all-choos","errorCode":null,"errorMessage":"You can not specify both \"--id\" and \"--all\". Choose one or the other.","messagePattern":"You can not specify both \"--id\" and \"--all\"\\. Choose one or the other\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php","lineNumber":53,"sourceCode":"  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $is_force = $args->getArg('force');\n\n    $log_id = $args->getArg('id');\n    $is_all = $args->getArg('all');\n\n    if (!$is_all && !$log_id) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Choose a build log to rebuild with \"--id\", or rebuild all '.\n          'logs with \"--all\".'));\n    }\n\n    if ($is_all && $log_id) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'You can not specify both \"--id\" and \"--all\". Choose one or '.\n          'the other.'));\n    }\n\n    if ($log_id) {\n      $log = id(new HarbormasterBuildLogQuery())\n        ->setViewer($viewer)\n        ->withIDs(array($log_id))\n        ->executeOne();\n      if (!$log) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to load build log \"%s\".',\n            $log_id));\n      }\n      $logs = array($log);\n    } else {","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php#L35-L71","documentation":"Usage exception from 'bin/harbormaster rebuild-log'. The --id flag selects a single log and --all selects every log, so passing both is ambiguous (--all already includes the single log). The workflow enforces mutual exclusivity and aborts before running any queries.","triggerScenarios":"Running 'bin/harbormaster rebuild-log --id 42 --all'.","commonSituations":"A wrapper script that always passes --all and conditionally appends --id; command lines assembled by combining examples from two different runbook entries.","solutions":["Remove --all and keep '--id 42' to rebuild exactly one log","Or remove --id and keep --all to rebuild every log","Make wrapper scripts pass exactly one of the two flags (xor logic), never both"],"exampleFix":"# before\n$ bin/harbormaster rebuild-log --id 42 --all\n# after\n$ bin/harbormaster rebuild-log --id 42","handlingStrategy":"validation","validationCode":"# shell wrapper: exactly one of --id / --all\nif [ -n ${LOG_ID:-} ] && [ ${REBUILD_ALL:-0} -eq 1 ]; then\n  echo 'error: --id and --all are mutually exclusive' >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --id and --all as mutually exclusive in scripts; pass exactly one","Document the either/or requirement next to the command in runbooks"],"tags":["harbormaster","phabricator","cli","conflicting-options","build-log"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}