phacility/phabricator · error · Exception
Calls to "transaction.search" must specify either an "object
Error message
Calls to "transaction.search" must specify either an "objectType" or an "objectIdentifier"
What it means
transaction.search must know which application's transactions to load, either by object type (objectType, a PHID type constant) or by a concrete object (objectIdentifier used to load a template object). With both values null, the method cannot pick a query template and throws this Exception before any querying. Exactly one of the two keys must be present.
Source
Thrown at src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php:366
);
}
return array(
'operations' => $operations,
);
}
private function loadTemplateObject(ConduitAPIRequest $request) {
$viewer = $request->getUser();
$object_identifier = $request->getValue('objectIdentifier');
$object_type = $request->getValue('objectType');
$has_identifier = ($object_identifier !== null);
$has_type = ($object_type !== null);
if (!$has_type && !$has_identifier) {
throw new Exception(
pht(
'Calls to "transaction.search" must specify either an "objectType" '.
'or an "objectIdentifier"'));
} else if ($has_type && $has_identifier) {
throw new Exception(
pht(
'Calls to "transaction.search" must not specify both an '.
'"objectType" and an "objectIdentifier".'));
}
if ($has_type) {
$all_types = PhabricatorPHIDType::getAllTypes();
if (!isset($all_types[$object_type])) {
ksort($all_types);
throw new Exception(
pht(
'In call to "transaction.search", specified "objectType" ("%s") '.View on GitHub (pinned to 5720a38cfe)
Solutions
- Pass objectType (a PHID type constant like TASK) to search transactions across objects of that type.
- Or pass objectIdentifier (e.g. 'T123', a monogram, or a raw PHID) to scope to one object.
- Assert exactly one of the two keys is set before sending the request.
Example fix
# before
{"limit": 100}
# after
{"objectType": "TASK", "limit": 100} Defensive patterns
Strategy: validation
Validate before calling
// require exactly one selector before calling transaction.search
$has_type = ($object_type !== null);
$has_id = ($object_identifier !== null);
if ($has_type === $has_id) {
throw new InvalidArgumentException(
'Pass exactly one of objectType or objectIdentifier.');
} Type guard
// PHP
function hasValidSelector($object_type, $object_identifier) {
return (($object_type !== null) xor ($object_identifier !== null));
} Try / catch
Catch the conduit error client-side, match 'must specify either', and abort with a programmer-facing message — this is a client bug, not transient state.
Prevention
- Build the selector exactly once in client code instead of merging defaults.
- Fail fast in client wrappers when neither selector is set.
When it happens
Trigger: A conduit call carrying only pagination keys (limit, after, before) with neither objectType nor objectIdentifier; a client that defaults both to null and sends them anyway.
Common situations: Client wrappers building the parameter dict from optional variables that are all unset; integrations copied from a minimal example that assumed a default object type.
Related errors
- Constraint "phids" to "transaction.search" requires nonempty
- Constraint "authorPHIDs" to "transaction.search" requires no
- 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/eafb18e23a76e689.
Report an issue: GitHub.