{"record":{"id":"139c03499bc1a07a","repo":"phacility/phabricator","slug":"username-is-invalid-s","errorCode":null,"errorMessage":"Username is invalid! %s","messagePattern":"Username is invalid! (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/people/editor/PhabricatorUserEditor.php","lineNumber":48,"sourceCode":"      throw new Exception(pht('User has already been created!'));\n    }\n\n    $is_reassign = false;\n    if ($email->getID()) {\n      if ($allow_reassign) {\n        if ($email->getIsPrimary()) {\n          throw new Exception(\n            pht('Primary email addresses can not be reassigned.'));\n        }\n        $is_reassign = true;\n      } else {\n        throw new Exception(pht('Email has already been created!'));\n      }\n    }\n\n    if (!PhabricatorUser::validateUsername($user->getUsername())) {\n      $valid = PhabricatorUser::describeValidUsername();\n      throw new Exception(pht('Username is invalid! %s', $valid));\n    }\n\n    // Always set a new user's email address to primary.\n    $email->setIsPrimary(1);\n\n    // If the primary address is already verified, also set the verified flag\n    // on the user themselves.\n    if ($email->getIsVerified()) {\n      $user->setIsEmailVerified(1);\n    }\n\n    $this->willAddEmail($email);\n\n    $user->openTransaction();\n      try {\n        $user->save();\n        $email->setUserPHID($user->getPHID());\n        $email->save();","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/people/editor/PhabricatorUserEditor.php#L30-L66","documentation":"Error \"Username is invalid! %s\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/people/editor/PhabricatorUserEditor.php:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}