{"record":{"id":"187cd779f9904d22","repo":"phacility/phabricator","slug":"user-account-s-is-not-disabled-you-can-only-en","errorCode":null,"errorMessage":"User account \"%s\" is not disabled. You can only enable accounts that are disabled.","messagePattern":"User account \"(.+?)\" is not disabled\\. You can only enable accounts that are disabled\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/people/management/PhabricatorPeopleManagementEnableWorkflow.php","lineNumber":23,"sourceCode":"\n  protected function didConstruct() {\n    $arguments = array_merge(\n      $this->getUserSelectionArguments(),\n      array());\n\n    $this\n      ->setName('enable')\n      ->setExamples('**enable** --user __username__')\n      ->setSynopsis(pht('Enable a disabled user account.'))\n      ->setArguments($arguments);\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $user = $this->selectUser($args);\n    $display_name = $user->getUsername();\n\n    if (!$user->getIsDisabled()) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'User account \"%s\" is not disabled. You can only enable accounts '.\n          'that are disabled.',\n          $display_name));\n    }\n\n    $xactions = array();\n    $xactions[] = $user->getApplicationTransactionTemplate()\n      ->setTransactionType(PhabricatorUserDisableTransaction::TRANSACTIONTYPE)\n      ->setNewValue(false);\n\n    $this->applyTransactions($user, $xactions);\n\n    $this->logOkay(\n      pht('DONE'),\n      pht('Enabled user account \"%s\".', $display_name));\n\n    return 0;","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/people/management/PhabricatorPeopleManagementEnableWorkflow.php#L5-L41","documentation":"Thrown by `bin/people enable --user <username>` when the target account is NOT disabled. Enable exists solely to reverse a disable (it applies PhabricatorUserDisableTransaction with new value false); enabling an active account would be a no-op, so the workflow aborts with a PhutilArgumentUsageException before writing transactions.","triggerScenarios":"Running `./bin/people enable --user alice` on an active, never-disabled account; re-enabling a user who was already re-enabled by a previous run; scripts that enable whole user lists without checking state.","commonSituations":"Recovery scripts run twice; operators confusing enable/disable direction; LDAP/SSO onboarding automation that calls enable defensively on every login.","solutions":["No action needed - the account is already enabled","To disable instead, run `./bin/people disable --user <username>`","In scripts, check getIsDisabled() (or Conduit user.query) before calling enable and treat this message as a no-op success"],"exampleFix":"# before\n./bin/people enable --user alice\n# after (idempotent script guard)\n./bin/people enable --user \"$USERNAME\" 2>&1 | grep -q 'not disabled' \\\n  && echo \"$USERNAME: already enabled (ok)\"","handlingStrategy":"validation","validationCode":"$user = id(new PhabricatorPeopleQuery())\n  ->setViewer($viewer)\n  ->withUsernames(array($username))\n  ->executeOne();\nif (!$user || !$user->getIsDisabled()) {\n  return; // nothing to enable\n}","typeGuard":"function needsEnable(PhabricatorUser $user) {\n  return (bool)$user->getIsDisabled();\n}","tryCatchPattern":null,"preventionTips":["Check isDisabled before calling `bin/people enable`","Remember the inverse command: disable sets the flag, enable clears it","Treat 'not disabled' as an idempotent success in recovery scripts"],"tags":["phabricator","cli","people","disabled-account","phutil","idempotency"],"backgroundTag":"invalid-state-transition","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}