{"record":{"id":"481d933757b8bba4","repo":"phacility/phabricator","slug":"specify-either-start-or-stop-but-not-both","errorCode":null,"errorMessage":"Specify either \"--start\" or \"--stop\", but not both.","messagePattern":"Specify either \"--start\" or \"--stop\", but not both\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php","lineNumber":56,"sourceCode":"    $repositories = $this->loadRepositories($args, 'repositories');\n    if (!$repositories) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify one or more repositories to act on.'));\n    }\n\n    $message = $args->getArg('start');\n    $is_start = (bool)strlen($message);\n    $is_stop = $args->getArg('stop');\n\n    if (!$is_start && !$is_stop) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Use \"--start <message>\" to put repositories into maintenance '.\n          'mode, or \"--stop\" to take them out of maintenance mode.'));\n    }\n\n    if ($is_start && $is_stop) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify either \"--start\" or \"--stop\", but not both.'));\n    }\n\n    $content_source = $this->newContentSource();\n    $diffusion_phid = id(new PhabricatorDiffusionApplication())->getPHID();\n\n    if ($is_start) {\n      $new_value = $message;\n    } else {\n      $new_value = null;\n    }\n\n    foreach ($repositories as $repository) {\n      $xactions = array();\n\n      $xactions[] = $repository->getApplicationTransactionTemplate()\n        ->setTransactionType(","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php#L38-L74","documentation":"Usage error from `bin/repository maintenance`: both `--start <message>` and `--stop` were supplied at once. The two modes are mutually exclusive because they write opposite values (message vs null) to the repository's maintenance configuration, so the workflow aborts before any write.","triggerScenarios":"Running `./bin/repository maintenance R1 --start \"msg\" --stop`; a wrapper script accumulates flags and ends up passing both from previous invocations.","commonSituations":"Copy-paste editing of a previous command leaves the old flag in place; automation templates concatenate a default `--stop` with an operator-supplied `--start`.","solutions":["Remove one of the flags — start to enter, stop to leave maintenance mode.","In scripts, build the flag list exclusively (`MODE=(--start \"$MSG\")` or `MODE=(--stop)`, then use `\"${MODE[@]}\"`)."],"exampleFix":"// before\n$ ./bin/repository maintenance R1 --start \"msg\" --stop\n[1172] Specify either \"--start\" or \"--stop\", but not both.\n\n// after\n$ ./bin/repository maintenance R1 --stop","handlingStrategy":"validation","validationCode":"if [ \"$ACTION\" = start ]; then flags=(--start \"$MSG\"); else flags=(--stop); fi\n./bin/repository maintenance \"$@\" \"${flags[@]}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model start/stop as a single mutually exclusive mode variable in automation.","Never concatenate flag strings from previous invocations; rebuild the argument list each run."],"tags":["phabricator","phorge","cli","usage-error","mutually-exclusive-flags","maintenance-mode"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}