phacility/phabricator · error · ConduitException

ERR_WRONG_USER

ERR_WRONG_USER

Error message

ERR_WRONG_USER

What it means

Conduit error code for flag.delete: the flag row was found, but its owner PHID does not equal the calling user's PHID. Flags are private, so attempting to delete another user's flag is rejected with this code before any deletion occurs.

Solutions

  1. Authenticate as the flag's creator to delete it
  2. Pick a flag owned by the current user
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/flag/conduit/FlagDeleteConduitAPIMethod.php:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/4fe43729aa8d8867. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/flag/conduit/FlagDeleteConduitAPIMethod.php:41

  protected function defineErrorTypes() {
    return array(
      'ERR_NOT_FOUND'  => pht('Bad flag ID.'),
      'ERR_WRONG_USER' => pht('You are not the creator of this flag.'),
      'ERR_NEED_PARAM' => pht('Must pass an id or an objectPHID.'),
    );
  }

  protected function execute(ConduitAPIRequest $request) {
    $id = $request->getValue('id');
    $object = $request->getValue('objectPHID');
    if ($id) {
      $flag = id(new PhabricatorFlag())->load($id);
      if (!$flag) {
        throw new ConduitException('ERR_NOT_FOUND');
      }
      if ($flag->getOwnerPHID() != $request->getUser()->getPHID()) {
        throw new ConduitException('ERR_WRONG_USER');
      }
    } else if ($object) {
      $flag = id(new PhabricatorFlag())->loadOneWhere(
        'objectPHID = %s AND ownerPHID = %s',
        $object,
        $request->getUser()->getPHID());
      if (!$flag) {
        return null;
      }
    } else {
      throw new ConduitException('ERR_NEED_PARAM');
    }
    $this->attachHandleToFlag($flag, $request->getUser());
    $ret = $this->buildFlagInfoDictionary($flag);
    $flag->delete();
    return $ret;
  }

View on GitHub (pinned to 5720a38cfe)