{"record":{"id":"b1a5199acc21ae7d","repo":"phacility/phabricator","slug":"user-phid-s-is-not-a-valid-user","errorCode":null,"errorMessage":"User PHID (\"%s\") is not a valid user.","messagePattern":"User PHID \\(\"(.+?)\"\\) is not a valid user\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php","lineNumber":55,"sourceCode":"          'Owner rule value is required. Specify a user to assign tasks '.\n          'to, or the token \"none()\" to unassign tasks.'));\n    }\n\n    if (count($value) > 1) {\n      throw new Exception(\n        pht(\n          'Owner rule value must have only one elmement (value is \"%s\").',\n          implode(', ', $value)));\n    }\n\n    $owner_phid = $this->convertTokenizerValueToOwner($value);\n    if ($owner_phid !== null) {\n      $user = id(new PhabricatorPeopleQuery())\n        ->setViewer($this->getViewer())\n        ->withPHIDs(array($owner_phid))\n        ->executeOne();\n      if (!$user) {\n        throw new Exception(\n          pht(\n            'User PHID (\"%s\") is not a valid user.',\n            $owner_phid));\n      }\n    }\n  }\n\n  protected function newDropTransactions($object, $value) {\n    $value = $this->convertTokenizerValueToOwner($value);\n    return array(\n      $this->newTransaction()\n        ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE)\n        ->setNewValue($value),\n    );\n  }\n\n  protected function newDropEffects($value) {\n    $owner_value = $this->convertTokenizerValueToOwner($value);","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php#L37-L73","documentation":"Thrown by assertValidRuleRecordValue() for the 'task.owner' rule when the selected PHID does not resolve to a visible user. The rule loads the PHID with PhabricatorPeopleQuery under the current viewer; if executeOne() returns nothing (unknown PHID, deleted/disabled user, or policy-hidden user), it throws.","triggerScenarios":"A task.owner rule holding a stale PHID (e.g. PHID-USER of an account deleted since the trigger was created), a malformed PHID, or a user the acting viewer cannot see. Surfaces when the trigger editor validates/saves, and when the rule is checked while applying the trigger.","commonSituations":"User account deleted or disabled after the trigger was configured; data imported between instances so PHIDs do not match; typo'd PHID in a hand-built record; the daemon/acting user lacks permission to see the owner.","solutions":["Open the trigger and re-pick the owner from the tokenizer so a fresh, valid PHID is stored, or use none().","If the owner left, update the trigger to their replacement or to none() to unassign tasks.","For cross-instance imports, remap user PHIDs before importing trigger records.","Confirm the viewer that validates/applies the trigger can see the target user under policies."],"exampleFix":"// before\n$value = array('PHID-USER-deleted');\n\n// after\n$value = array('PHID-USER-current');\n// or: $value = array('none()');","handlingStrategy":"validation","validationCode":"// Validate the owner resolves before saving:\n$user = id(new PhabricatorPeopleQuery())\n  ->setViewer($viewer)\n  ->withPHIDs(array($owner_phid))\n  ->executeOne();\nif (!$user) {\n  throw new Exception('Owner PHID does not resolve; pick a user or use none().');\n}","typeGuard":"function isResolvableOwnerPhid($viewer, $phid) {\n  if ($phid === null || $phid === 'none()') { return true; }\n  return (bool) id(new PhabricatorPeopleQuery())\n    ->setViewer($viewer)\n    ->withPHIDs(array($phid))\n    ->executeOne();\n}","tryCatchPattern":"$ex = $rule->getRuleRecordValueValidationException();\nif ($ex) { /* prompt user to re-pick owner; suggest none() */ }","preventionTips":["Re-validate owner PHIDs when users are deactivated or deleted.","Map PHIDs during instance migrations; never carry raw PHIDs across installs.","Store none() instead of a stale user when the owner leaves."],"tags":["php","phabricator","project-triggers","user-phid","stale-reference"],"backgroundTag":"invalid-user-reference","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}