{"record":{"id":"e785765eb0e9dac0","repo":"phacility/phabricator","slug":"err-invalid-parameter","errorCode":"ERR-INVALID-PARAMETER","errorMessage":"ERR-INVALID-PARAMETER","messagePattern":"ERR-INVALID-PARAMETER","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php","lineNumber":109,"sourceCode":"      $query->withReviewers($reviewers);\n    }\n\n    if ($path_pairs) {\n      throw new Exception(\n        pht(\n          'Parameter \"paths\" to Conduit API method \"differential.query\" is '.\n          'no longer supported. Use the \"paths\" constraint to '.\n          '\"differential.revision.search\" instead. See T13639.'));\n    }\n\n    if ($commit_hashes) {\n      $hash_types = ArcanistDifferentialRevisionHash::getTypes();\n      foreach ($commit_hashes as $info) {\n        list($type, $hash) = $info;\n        if (empty($type) ||\n            !in_array($type, $hash_types) ||\n            empty($hash)) {\n              throw new ConduitException('ERR-INVALID-PARAMETER');\n        }\n      }\n      $query->withCommitHashes($commit_hashes);\n    }\n\n    if ($status) {\n      $statuses = DifferentialLegacyQuery::getModernValues($status);\n      if ($statuses) {\n        $query->withStatuses($statuses);\n      }\n    }\n    if ($order) {\n      $query->setOrder($order);\n    }\n    if ($limit) {\n      $query->setLimit($limit);\n    }\n    if ($offset) {","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php#L91-L127","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Send each hash as a two-element array whose type comes from ArcanistDifferentialRevisionHash::getTypes() and whose hash is a non-empty string.","Validate every pair client-side before the call: type non-empty and in the allowed set, hash non-empty.","Prefer differential.revision.search with constraints.commitHashes on modern instances."],"exampleFix":"// before\n$params['commitHashes'] = array(array('git', $sha));\n$client->callMethodSynchronous('differential.query', $params);\n\n// after\n// $valid_type comes from ArcanistDifferentialRevisionHash::getTypes()\nif ($valid_type === null || $sha === null || $sha === '') {\n  throw new InvalidArgumentException('Malformed commit hash pair.');\n}\n$params['commitHashes'] = array(array($valid_type, $sha));\n$client->callMethodSynchronous('differential.query', $params);","handlingStrategy":"validation","validationCode":"$valid_types = array(); // fill from ArcanistDifferentialRevisionHash::getTypes()\nforeach ($commit_hashes as $pair) {\n  list($type, $hash) = array_pad((array)$pair, 2, null);\n  if ($type === null || $hash === null || $hash === '' ||\n      !in_array($type, $valid_types, true)) {\n    throw new InvalidArgumentException('Malformed commit hash pair.');\n  }\n}","typeGuard":"function isValidHashPair($pair) {\n  return is_array($pair) && count($pair) === 2 &&\n    is_string($pair[0]) && strlen($pair[0]) > 0 &&\n    is_string($pair[1]) && strlen($pair[1]) > 0;\n}","tryCatchPattern":"try {\n  $result = $client->callMethodSynchronous('differential.query', $params);\n} catch (ConduitClientException $ex) {\n  if ($ex->getErrorCode() === 'ERR-INVALID-PARAMETER') {\n    // revalidate each commit_hashes pair against getTypes() and fix the client\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Derive hash type constants from ArcanistDifferentialRevisionHash::getTypes(); never guess names.","Validate pairs client-side before the conduit call.","Prefer differential.revision.search with constraints.commitHashes on modern instances."],"tags":["phabricator","conduit","commit-hash","validation"],"backgroundTag":"invalid-request-parameter","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}