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
- Only include authorPHIDs in the constraints when the list has at least one PHID.
- Pass at least one author PHID when author filtering is intended.
- 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
- Map empty UI multi-selects to an omitted key, not an empty array.
- Unit-test client serialization with empty filter inputs.
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
- Constraint "phids" to "transaction.search" requires nonempty
- Calls to "transaction.search" must specify either an "object
- Calls to "transaction.search" must not specify both an "obje
- API Method "%s" defines a disallowed parameter, "%s". This p
- API Method "%s" does not define these parameters: %s.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/611f90a47ceba0da.
Report an issue: GitHub.