phacility/phabricator · error · ConduitException

ERR-INVALID-PARAMETER

ERR-INVALID-PARAMETER

Error message

ERR-INVALID-PARAMETER

What it means

differential.query validates each entry of commit_hashes as a (type, hash) pair before querying: type must be one of the hash-type constants returned by ArcanistDifferentialRevisionHash::getTypes() and hash must be non-empty. A malformed pair throws ERR-INVALID-PARAMETER.

Source

Thrown at src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php:109

      $query->withReviewers($reviewers);
    }

    if ($path_pairs) {
      throw new Exception(
        pht(
          'Parameter "paths" to Conduit API method "differential.query" is '.
          'no longer supported. Use the "paths" constraint to '.
          '"differential.revision.search" instead. See T13639.'));
    }

    if ($commit_hashes) {
      $hash_types = ArcanistDifferentialRevisionHash::getTypes();
      foreach ($commit_hashes as $info) {
        list($type, $hash) = $info;
        if (empty($type) ||
            !in_array($type, $hash_types) ||
            empty($hash)) {
              throw new ConduitException('ERR-INVALID-PARAMETER');
        }
      }
      $query->withCommitHashes($commit_hashes);
    }

    if ($status) {
      $statuses = DifferentialLegacyQuery::getModernValues($status);
      if ($statuses) {
        $query->withStatuses($statuses);
      }
    }
    if ($order) {
      $query->setOrder($order);
    }
    if ($limit) {
      $query->setLimit($limit);
    }
    if ($offset) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Send each hash as a two-element array whose type comes from ArcanistDifferentialRevisionHash::getTypes() and whose hash is a non-empty string.
  2. Validate every pair client-side before the call: type non-empty and in the allowed set, hash non-empty.
  3. Prefer differential.revision.search with constraints.commitHashes on modern instances.

Example fix

// before
$params['commitHashes'] = array(array('git', $sha));
$client->callMethodSynchronous('differential.query', $params);

// after
// $valid_type comes from ArcanistDifferentialRevisionHash::getTypes()
if ($valid_type === null || $sha === null || $sha === '') {
  throw new InvalidArgumentException('Malformed commit hash pair.');
}
$params['commitHashes'] = array(array($valid_type, $sha));
$client->callMethodSynchronous('differential.query', $params);
Defensive patterns

Strategy: validation

Validate before calling

$valid_types = array(); // fill from ArcanistDifferentialRevisionHash::getTypes()
foreach ($commit_hashes as $pair) {
  list($type, $hash) = array_pad((array)$pair, 2, null);
  if ($type === null || $hash === null || $hash === '' ||
      !in_array($type, $valid_types, true)) {
    throw new InvalidArgumentException('Malformed commit hash pair.');
  }
}

Type guard

function isValidHashPair($pair) {
  return is_array($pair) && count($pair) === 2 &&
    is_string($pair[0]) && strlen($pair[0]) > 0 &&
    is_string($pair[1]) && strlen($pair[1]) > 0;
}

Try / catch

try {
  $result = $client->callMethodSynchronous('differential.query', $params);
} catch (ConduitClientException $ex) {
  if ($ex->getErrorCode() === 'ERR-INVALID-PARAMETER') {
    // revalidate each commit_hashes pair against getTypes() and fix the client
  } else {
    throw $ex;
  }
}

Prevention

When it happens

Trigger: Passing commit_hashes entries such as array(null, 'abc...'), array('bogus-type', 'abc...'), or array('some-type', '') — usually a client that invented its own type keys or dropped the hash value.

Common situations: Custom scripts that use plain names like 'git' or 'sha' instead of the expected constants; JSON round-trips that renamed the type key; integrations ported between VCS types with wrong hash-type mappings.

Related errors


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