phacility/phabricator · error · Exception

In call to "transaction.search", specified "objectType" ("%s

Error message

In call to "transaction.search", specified "objectType" ("%s") is unknown. Valid object types are: %s.

What it means

objectType must be one of the keys of PhabricatorPHIDType::getAllTypes() — PHID type constants such as TASK or CMIT, not class or application names. An unknown constant throws with the full sorted list of valid types appended, so the error message itself is the reference. The constant identifies the object family; Phabricator then instantiates a template object via the type's newObject().

Source

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

    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))));
      }

      $object = $all_types[$object_type]->newObject();
    } else {
      $object = id(new PhabricatorObjectQuery())
        ->setViewer($viewer)
        ->withNames(array($object_identifier))
        ->executeOne();
      if (!$object) {
        throw new Exception(
          pht(
            'In call to "transaction.search", specified "objectIdentifier" '.
            '("%s") does not exist.',

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use a PHID type constant from the list in the error message (e.g. TASK for Maniphest tasks).
  2. Deliberately call once with an invalid type to dump the valid list for your install, then correct the call.
  3. For custom object types, verify the constant registered by the application's PhabricatorPHIDType subclass.

Example fix

# before
{"objectType": "maniphest"}
# after
{"objectType": "TASK"}
Defensive patterns

Strategy: validation

Validate before calling

// PHP: whitelist against the install's registered PHID types
$valid_types = array_keys(PhabricatorPHIDType::getAllTypes());
if (!in_array($object_type, $valid_types, true)) {
  throw new InvalidArgumentException(
    'Unknown objectType. Valid: '.implode(', ', $valid_types));
}

Type guard

// PHP
function isKnownPhidType($type) {
  $all = PhabricatorPHIDType::getAllTypes();
  return isset($all[$type]);
}

Try / catch

Catch the conduit error client-side, parse the trailing 'Valid object types are:' list from the message, cache it, and re-validate locally next time.

Prevention

When it happens

Trigger: Passing objectType: "ManiphestTask" or "maniphest" instead of "TASK"; using a custom object type constant that is not registered in this install.

Common situations: Assuming the parameter takes an application or class name; custom applications whose PHID type constants differ from what the caller guessed; constants renamed across versions.

Related errors


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