phacility/phabricator · error · PhutilArgumentUsageException

Service "%s" does not exist or could not be loaded!

Error message

Service "%s" does not exist or could not be loaded!

What it means

Thrown by the shared loadServices() helper in Almanac management workflows: one or more --service names passed on the command line did not resolve to an AlmanacService via AlmanacServiceQuery withNames(). The 'or could not be loaded' wording also covers the case where the row exists but the acting viewer cannot see it under policy rules.

Source

Thrown at src/applications/almanac/management/AlmanacManagementWorkflow.php:19

<?php

abstract class AlmanacManagementWorkflow
  extends PhabricatorManagementWorkflow {

  protected function loadServices(array $names) {
    if (!$names) {
      return array();
    }

    $services = id(new AlmanacServiceQuery())
      ->setViewer($this->getViewer())
      ->withNames($names)
      ->execute();

    $services = mpull($services, null, 'getName');
    foreach ($names as $name) {
      if (empty($services[$name])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Service "%s" does not exist or could not be loaded!',
            $name));
      }
    }

    return $services;
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Check the exact service name in the Almanac service UI (names are case-sensitive) and re-run with it verbatim.
  2. Confirm the service still exists and was not renamed or deleted.
  3. If policy filtering is plausible (workflow runs as a restricted viewer), verify the acting user can actually see that service.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-resolve names the way loadServices() does, before running the workflow:
$services = id(new AlmanacServiceQuery())
  ->setViewer($viewer)
  ->withNames($names)
  ->execute();
$missing = array_diff($names, mpull($services, 'getName'));
if ($missing) {
  throw new Exception('Unknown/invisible services: '.implode(', ', $missing));
}

Try / catch

try {
  // execute management workflow taking --service names
} catch (PhutilArgumentUsageException $ex) {
  if (preg_match('/does not exist or could not be loaded/', $ex->getMessage())) {
    // Re-check spelling/case against the service list, then retry once.
  }
  throw $ex;
}

Prevention

When it happens

Trigger: Running any Almanac management workflow that accepts service names (e.g. binding workflows) with a name that has a typo, wrong case, extra whitespace, or that designates a service the viewer cannot load; withNames() is exact-match, not fuzzy.

Common situations: Copying a service name from notes that has since been renamed; case mismatches ('MyService' vs 'myservice'); referencing a deleted service in automation after a cleanup.

Related errors


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