{"record":{"id":"8b376933af349e73","repo":"phacility/phabricator","slug":"when-creating-a-new-almanac-binding-via-the-condui","errorCode":null,"errorMessage":"When creating a new Almanac binding via the Conduit API, you must provide a \"service\" transaction to select a service to bind.","messagePattern":"When creating a new Almanac binding via the Conduit API, you must provide a \"service\" transaction to select a service to bind\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/editor/AlmanacBindingEditEngine.php","lineNumber":65,"sourceCode":"  protected function newEditableObjectForDocumentation() {\n    $service_type = AlmanacCustomServiceType::SERVICETYPE;\n    $service = AlmanacService::initializeNewService($service_type);\n    $this->setService($service);\n    return $this->newEditableObject();\n  }\n\n  protected function newEditableObjectFromConduit(array $raw_xactions) {\n    $service_phid = null;\n    foreach ($raw_xactions as $raw_xaction) {\n      if ($raw_xaction['type'] !== 'service') {\n        continue;\n      }\n\n      $service_phid = $raw_xaction['value'];\n    }\n\n    if ($service_phid === null) {\n      throw new Exception(\n        pht(\n          'When creating a new Almanac binding via the Conduit API, you '.\n          'must provide a \"service\" transaction to select a service to bind.'));\n    }\n\n    $service = id(new AlmanacServiceQuery())\n      ->setViewer($this->getViewer())\n      ->withPHIDs(array($service_phid))\n      ->requireCapabilities(\n        array(\n          PhabricatorPolicyCapability::CAN_VIEW,\n          PhabricatorPolicyCapability::CAN_EDIT,\n        ))\n      ->executeOne();\n    if (!$service) {\n      throw new Exception(\n        pht(\n          'Service \"%s\" is unrecognized, restricted, or you do not have '.","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/editor/AlmanacBindingEditEngine.php#L47-L83","documentation":"Thrown by PhabricatorRepositoryManagementWorkflow::loadNamedCommits() when a commit identifier passed to a management workflow does not appear in DiffusionCommitQuery's identifier map. The map resolves commit names (usually abbreviated hashes) against imported commits; a miss means the commit either does not exist in Phabricator or the abbreviation is ambiguous because it prefixes multiple imported commits. Longer hashes or full 40-character SHA-1s resolve unambiguously.","triggerScenarios":"Passing a short or wrong hash to a workflow that takes commit names (loadCommits/loadNamedCommit callers), e.g. 'bin/repository ... abc12': DiffusionCommitQuery->withIdentifiers() cannot map it uniquely, the map lacks the key at PhabricatorRepositoryManagementWorkflow.php:90, and the exception fires.","commonSituations":"Copying a truncated hash from a terminal that elided characters; using a hash from a fork or unpushed branch that Phabricator never imported; ambiguous short hashes after the repository grew; commits not yet imported by discovery.","solutions":["Use the full commit hash (40 hex chars for Git/Mercurial) from the Diffusion UI or 'git rev-parse'.","If abbreviating, lengthen the prefix until it is unique.","If the commit should exist, wait for (or trigger) discovery/import and retry."],"exampleFix":"# before\nbin/repository marking abc12 ...\n\n# after\nbin/repository marking 3f9c1a7d2e8b4...  # full hash from git rev-parse HEAD","handlingStrategy":"validation","validationCode":"// Resolve to a unique commit before invoking the workflow:\n$map = id(new DiffusionCommitQuery())\n  ->setViewer($viewer)\n  ->withIdentifiers(array($name))\n  ->executeAndGetIdentifierMap();\nif (empty($map[$name])) { /* lengthen hash or verify the commit was imported */ }","typeGuard":null,"tryCatchPattern":"catch (PhutilArgumentUsageException $ex) {\n  if (preg_match('/does not exist or is ambiguous/', $ex->getMessage())) { /* retry with full hash */ }\n}","preventionTips":["Always pass full 40-character hashes in scripts.","Confirm discovery/import completed before referencing brand-new commits."],"tags":["phabricator","cli","entity-not-found","commit-identifier","ambiguous-hash"],"backgroundTag":"ambiguous-identifier","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}