phacility/phabricator · error · Exception

Object " " does not implement interface " ". Autotargets…

Error message

Object "%s" does not implement interface "%s". Autotargets may only be queried for buildable objects.

What it means

Interface guard in 'harbormaster.queryautotargets': the resolved object does not implement HarbormasterBuildableInterface, so autotargets (which are derived from buildable objects) cannot be queried for it.

Solutions

  1. Query autotargets only for buildable objects (revisions, commits, etc.)
  2. Check that the PHID points to the object type you intended
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/applications/harbormaster/conduit/HarbormasterQueryAutotargetsConduitAPIMethod.php:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/applications/harbormaster/conduit/HarbormasterQueryAutotargetsConduitAPIMethod.php:45

    $phid = $request->getValue('objectPHID');

    // NOTE: We use withNames() to let monograms like "D123" work, which makes
    // this a little easier to test. Real PHIDs will still work as expected.

    $object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withNames(array($phid))
      ->executeOne();
    if (!$object) {
      throw new Exception(
        pht(
          'No such object "%s" exists.',
          $phid));
    }

    if (!($object instanceof HarbormasterBuildableInterface)) {
      throw new Exception(
        pht(
          'Object "%s" does not implement interface "%s". Autotargets may '.
          'only be queried for buildable objects.',
          $phid,
          'HarbormasterBuildableInterface'));
    }

    $autotargets = $request->getValue('targetKeys', array());

    if ($autotargets) {
      $targets = id(new HarbormasterTargetEngine())
        ->setViewer($viewer)
        ->setObject($object)
        ->setAutoTargetKeys($autotargets)
        ->buildTargets();
    } else {
      $targets = array();
    }

View on GitHub (pinned to 5720a38cfe)