phacility/phabricator · error · Exception

Call includes "unit" parameter. This parameter must be…

Error message

Call includes "unit" parameter. This parameter must be omitted when the receiver is not a Build Target.

What it means

Parameter-scope guard in 'harbormaster.sendmessage': a 'unit' result parameter was sent, but the receiver is not a HarbormasterBuildTarget (unit results attach only to build targets, not builds/buildables).

Solutions

  1. Send 'unit' only when 'receiver' is a build target PHID
  2. Send unit results to the build target receiver instead of the build
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php:550 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/996136ce3348244a. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/harbormaster/conduit/HarbormasterSendMessageConduitAPIMethod.php:550

    $receiver_object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withNames(array($receiver_name))
      ->executeOne();
    if (!$receiver_object) {
      throw new Exception(
        pht(
          'Unable to load object "%s" to receive message.',
          $receiver_name));
    }

    $is_target = ($receiver_object instanceof HarbormasterBuildTarget);
    if ($is_target) {
      return $this->sendToTarget($request, $message_type, $receiver_object);
    }

    if ($request->getValue('unit') !== null) {
      throw new Exception(
        pht(
          'Call includes "unit" parameter. This parameter must be omitted '.
          'when the receiver is not a Build Target.'));
    }

    if ($request->getValue('lint') !== null) {
      throw new Exception(
        pht(
          'Call includes "lint" parameter. This parameter must be omitted '.
          'when the receiver is not a Build Target.'));
    }

    $is_build = ($receiver_object instanceof HarbormasterBuild);
    if ($is_build) {
      return $this->sendToBuild($request, $message_type, $receiver_object);
    }

    $is_buildable = ($receiver_object instanceof HarbormasterBuildable);

View on GitHub (pinned to 5720a38cfe)