phacility/phabricator · error · Exception
Calls to "transaction.search" must not specify both an "obje
Error message
Calls to "transaction.search" must not specify both an "objectType" and an "objectIdentifier".
What it means
objectType and objectIdentifier are mutually exclusive: the first builds a fresh template object from a PHID type, the second loads an existing object by name. Supplying both is ambiguous and rejected with this Exception. The xor check ($has_type && $has_identifier) runs before any lookup, so the conflict is caught regardless of whether the values are individually valid.
Source
Thrown at src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php:371
);
}
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") '.
'is unknown. Valid object types are: %s.',
$object_type,
implode(', ', array_keys($all_types))));
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Send exactly one of the two keys; drop the other.
- Fix client merge logic so defaults do not resurrect a key the caller left unset.
- When you hold a concrete object, prefer objectIdentifier alone.
Example fix
# before
{"objectType": "TASK", "objectIdentifier": "T123"}
# after
{"objectIdentifier": "T123"} Defensive patterns
Strategy: validation
Validate before calling
// reject both-selectors-present before calling
if ($object_type !== null && $object_identifier !== null) {
throw new InvalidArgumentException(
'objectType and objectIdentifier are mutually exclusive.');
} Type guard
// PHP
function selectorsAreExclusive($object_type, $object_identifier) {
return !($object_type !== null && $object_identifier !== null);
} Try / catch
Catch the conduit error client-side, match 'must not specify both', strip one selector, and re-send once with the preferred key.
Prevention
- Do not merge a defaults dict over user-supplied parameters without unsetting nulls.
- Prefer objectIdentifier when a concrete object is known.
When it happens
Trigger: A conduit call setting both objectType and objectIdentifier, e.g. {"objectType": "TASK", "objectIdentifier": "T123"} — typically a client that fills in every known field.
Common situations: Over-eager generated clients populating all optional parameters; code paths merging a 'defaults' dict with user-supplied values, ending up with both keys.
Related errors
- Constraint "phids" to "transaction.search" requires nonempty
- Constraint "authorPHIDs" to "transaction.search" requires no
- Calls to "transaction.search" must specify either an "object
- 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/e9e8340057ca4863.
Report an issue: GitHub.