phacility/phabricator · error · Exception

When creating a new Almanac binding via the Conduit API, you

Error message

When creating a new Almanac binding via the Conduit API, you must provide a "service" transaction to select a service to bind.

What it means

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.

Source

Thrown at src/applications/almanac/editor/AlmanacBindingEditEngine.php:65

  protected function newEditableObjectForDocumentation() {
    $service_type = AlmanacCustomServiceType::SERVICETYPE;
    $service = AlmanacService::initializeNewService($service_type);
    $this->setService($service);
    return $this->newEditableObject();
  }

  protected function newEditableObjectFromConduit(array $raw_xactions) {
    $service_phid = null;
    foreach ($raw_xactions as $raw_xaction) {
      if ($raw_xaction['type'] !== 'service') {
        continue;
      }

      $service_phid = $raw_xaction['value'];
    }

    if ($service_phid === null) {
      throw new Exception(
        pht(
          'When creating a new Almanac binding via the Conduit API, you '.
          'must provide a "service" transaction to select a service to bind.'));
    }

    $service = id(new AlmanacServiceQuery())
      ->setViewer($this->getViewer())
      ->withPHIDs(array($service_phid))
      ->requireCapabilities(
        array(
          PhabricatorPolicyCapability::CAN_VIEW,
          PhabricatorPolicyCapability::CAN_EDIT,
        ))
      ->executeOne();
    if (!$service) {
      throw new Exception(
        pht(
          'Service "%s" is unrecognized, restricted, or you do not have '.

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use the full commit hash (40 hex chars for Git/Mercurial) from the Diffusion UI or 'git rev-parse'.
  2. If abbreviating, lengthen the prefix until it is unique.
  3. If the commit should exist, wait for (or trigger) discovery/import and retry.

Example fix

# before
bin/repository marking abc12 ...

# after
bin/repository marking 3f9c1a7d2e8b4...  # full hash from git rev-parse HEAD
Defensive patterns

Strategy: validation

Validate before calling

// Resolve to a unique commit before invoking the workflow:
$map = id(new DiffusionCommitQuery())
  ->setViewer($viewer)
  ->withIdentifiers(array($name))
  ->executeAndGetIdentifierMap();
if (empty($map[$name])) { /* lengthen hash or verify the commit was imported */ }

Try / catch

catch (PhutilArgumentUsageException $ex) {
  if (preg_match('/does not exist or is ambiguous/', $ex->getMessage())) { /* retry with full hash */ }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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