{"record":{"id":"51022f8cc0d8216a","repo":"phacility/phabricator","slug":"use-start-message-to-put-repositories-into-m","errorCode":null,"errorMessage":"Use \"--start <message>\" to put repositories into maintenance mode, or \"--stop\" to take them out of maintenance mode.","messagePattern":"Use \"--start <message>\" to put repositories into maintenance mode, or \"--stop\" to take them out of maintenance mode\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php","lineNumber":49,"sourceCode":"          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $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;","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php#L31-L67","documentation":"Usage error from `bin/repository maintenance`: neither `--start <message>` nor `--stop` was supplied (`$is_start` is false because the message is empty, and `$is_stop` is false). The workflow is strictly a toggle between entering and leaving maintenance mode, so it refuses to run with no direction.","triggerScenarios":"Running `./bin/repository maintenance R1` with repositories but no mode flags; passing `--start` with an empty string message (`--start ''`), which counts as not starting because the check is `strlen($message)`.","commonSituations":"Operators forget the mode flag entirely; scripts pass an empty variable message (`--start \"$MSG\"` with MSG unset) and silently hit the same guard.","solutions":["To enter maintenance mode: `./bin/repository maintenance R1 --start \"reason\"`.","To leave it: `./bin/repository maintenance R1 --stop`.","If scripting, guard against empty messages: `[ -n \"$MSG\" ] && ./bin/repository maintenance R1 --start \"$MSG\"`."],"exampleFix":"// before\n$ ./bin/repository maintenance R1\n[1171] Use \"--start <message>\" ... or \"--stop\" ...\n\n// after\n$ ./bin/repository maintenance R1 --start \"reindexing storage\"","handlingStrategy":"validation","validationCode":"if [ -n \"$MSG\" ]; then ./bin/repository maintenance R1 --start \"$MSG\"; else ./bin/repository maintenance R1 --stop; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair repositories with exactly one mode flag (--start with non-empty message, or --stop).","An empty --start '' counts as omitted — assert message length in scripts."],"tags":["phabricator","phorge","cli","usage-error","missing-flag","maintenance-mode"],"backgroundTag":"missing-required-flag","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}