phacility/phabricator · error · Exception

No Almanac service type "%s" exists!

Error message

No Almanac service type "%s" exists!

What it means

AlmanacService::initializeNewService() validates the requested service type against AlmanacServiceType::getAllServiceTypes(), a registry map of installed service type implementations. An unknown type string means no installed class claims that key, so object initialization aborts before any row is created.

Source

Thrown at src/applications/almanac/storage/AlmanacService.php:31

    PhabricatorExtendedPolicyInterface {

  protected $name;
  protected $nameIndex;
  protected $viewPolicy;
  protected $editPolicy;
  protected $serviceType;

  private $almanacProperties = self::ATTACHABLE;
  private $bindings = self::ATTACHABLE;
  private $activeBindings = self::ATTACHABLE;
  private $serviceImplementation = self::ATTACHABLE;

  public static function initializeNewService($type) {
    $type_map = AlmanacServiceType::getAllServiceTypes();

    $implementation = idx($type_map, $type);
    if (!$implementation) {
      throw new Exception(
        pht(
          'No Almanac service type "%s" exists!',
          $type));
    }

    return id(new AlmanacService())
      ->setViewPolicy(PhabricatorPolicies::POLICY_USER)
      ->setEditPolicy(PhabricatorPolicies::POLICY_ADMIN)
      ->attachAlmanacProperties(array())
      ->setServiceType($type)
      ->attachServiceImplementation($implementation);
  }

  protected function getConfiguration() {
    return array(
      self::CONFIG_AUX_PHID => true,
      self::CONFIG_COLUMN_SCHEMA => array(
        'name' => 'text128',

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Inspect the valid type identifiers: var_export(array_keys(AlmanacServiceType::getAllServiceTypes())) and use one of those strings exactly.
  2. For a missing custom type, confirm its class extends AlmanacServiceType, lives in a library listed under phabricator.load-libraries, and that the library loads cleanly on this host.
  3. If the type class was renamed, update scripts/records to the new type string instead of re-adding the old class.

Example fix

// before
$service = AlmanacService::initializeNewService('custom.mytype'); // throws if unregistered

// after
$types = AlmanacServiceType::getAllServiceTypes();
if (!isset($types['custom.mytype'])) {
  throw new Exception('Type not registered; available: '.implode(', ', array_keys($types)));
}
$service = AlmanacService::initializeNewService('custom.mytype');
Defensive patterns

Strategy: validation

Validate before calling

$type_map = AlmanacServiceType::getAllServiceTypes();
if (!isset($type_map[$type])) {
  throw new Exception(
    "Unknown service type '{$type}'. Registered types: ".
    implode(', ', array_keys($type_map)));
}
$service = AlmanacService::initializeNewService($type);

Type guard

function isRegisteredAlmanacServiceType($type) {
  return isset(AlmanacServiceType::getAllServiceTypes()[$type]);
}

Try / catch

try {
  $service = AlmanacService::initializeNewService($type);
} catch (Exception $ex) {
  // Fall back to reporting the registered types so the operator can correct input.
  $known = implode(', ', array_keys(AlmanacServiceType::getAllServiceTypes()));
  throw new Exception($ex->getMessage()." Registered types: {$known}");
}

Prevention

When it happens

Trigger: Creating a service (UI, Conduit, or script) with serviceType set to a string that is not a key in getAllServiceTypes(); typically after a custom service type class was renamed, removed, or its defining phutil library stopped loading.

Common situations: Extension library not listed in phabricator.load-libraries after a deploy; renaming a custom AlmanacServiceType subclass but keeping old type strings in provisioning scripts; typo in a built-in type identifier.

Related errors


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