phacility/phabricator · error · Exception

Constraint "authorPHIDs" to "transaction.search" requires no

Error message

Constraint "authorPHIDs" to "transaction.search" requires nonempty list, empty list provided.

What it means

Identical shape to the phids constraint: constraints.authorPHIDs is optional, but an explicitly empty array is rejected because an IN-filter over zero authors matches nothing and almost always signals a client bug. The strict `=== array()` check only fires when the key is present with an empty list; null or a nonempty list passes through to withAuthorPHIDs().

Source

Thrown at src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php:318

        'authorPHIDs' => 'optional list<string>',
      ));

    $with_phids = idx($constraints, 'phids');

    if ($with_phids === array()) {
      throw new Exception(
        pht(
          'Constraint "phids" to "transaction.search" requires nonempty list, '.
          'empty list provided.'));
    }

    if ($with_phids) {
      $query->withPHIDs($with_phids);
    }

    $with_authors = idx($constraints, 'authorPHIDs');
    if ($with_authors === array()) {
      throw new Exception(
        pht(
          'Constraint "authorPHIDs" to "transaction.search" requires '.
          'nonempty list, empty list provided.'));
    }

    if ($with_authors) {
      $query->withAuthorPHIDs($with_authors);
    }

    return $query;
  }

  private function newEdgeTransactionFields(
    PhabricatorApplicationTransaction $xaction) {

    $record = PhabricatorEdgeChangeRecord::newFromTransaction($xaction);

    $operations = array();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Only include authorPHIDs in the constraints when the list has at least one PHID.
  2. Pass at least one author PHID when author filtering is intended.
  3. Centralize constraint building in one helper that strips empty lists.

Example fix

// before
$params = array('constraints' => array('authorPHIDs' => $authors));
// after
$params = array('constraints' => array());
if ($authors) {
  $params['constraints']['authorPHIDs'] = $authors;
}
Defensive patterns

Strategy: validation

Validate before calling

// strip empty constraint lists before the conduit call
$constraints = array();
if ($author_phids) {
  $constraints['authorPHIDs'] = $author_phids;
}
$parameters = array('constraints' => $constraints);

Type guard

// PHP: only nonempty string lists may be sent as authorPHIDs
function isValidAuthorList($value) {
  return $value === null
    || (is_array($value) && count($value) > 0
        && !in_array('', $value, true));
}

Try / catch

Catch the conduit error client-side, detect 'requires nonempty list' naming authorPHIDs, and re-send once with the empty list removed.

Prevention

When it happens

Trigger: Calling transaction.search with constraints: {"authorPHIDs": []} when the caller's author filter selection came out empty.

Common situations: Scripts that always populate authorPHIDs from a variable that can be empty; UI controllers forwarding an empty 'authors' tokenizer field.

Related errors


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