phacility/phabricator · error · Exception

You must select at least one project tag to add.

Error message

You must select at least one project tag to add.

What it means

Thrown by assertValidRuleRecordValue() for the 'task.projects.add' rule when the value list is empty. Unlike the format check, this runs at trigger-editor save time via getRuleRecordValueValidationException(), so it is validation of user input: an 'Add project tags' rule was configured without selecting any project.

Source

Thrown at src/applications/project/trigger/PhabricatorProjectTriggerAddProjectsRule.php:28

  }

  protected function getValueForEditorField() {
    return $this->getDatasource()->getWireTokens($this->getValue());
  }

  protected function assertValidRuleRecordFormat($value) {
    if (!is_array($value)) {
      throw new Exception(
        pht(
          'Add project rule value should be a list, but is not '.
          '(value is "%s").',
          phutil_describe_type($value)));
    }
  }

  protected function assertValidRuleRecordValue($value) {
    if (!$value) {
      throw new Exception(
        pht(
          'You must select at least one project tag to add.'));
    }
  }

  protected function newDropTransactions($object, $value) {
    $project_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST;

    $xaction = $object->getApplicationTransactionTemplate()
      ->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
      ->setMetadataValue('edge:type', $project_edge_type)
      ->setNewValue(
        array(
          '+' => array_fuse($value),
        ));

    return array($xaction);
  }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Open the trigger in the editor and select at least one project tag in the 'Add project tags' field, then save.
  2. If the tokenizer never loads options, check that the project datasource is reachable and the viewer can see projects (policy issue).
  3. If editing via Conduit/scripts, ensure the posted value is a non-empty array of project PHIDs.

Example fix

// before
$value = array();

// after
$value = array('PHID-PROJ-xyz');
Defensive patterns

Strategy: validation

Validate before calling

// Before saving the trigger in custom client code:
if (!$value) {
  throw new Exception('Select at least one project tag to add.');
}

Type guard

function isNonEmptyProjectList($value) {
  return is_array($value) && count($value) > 0;
}

Try / catch

$validation = $rule->getRuleRecordValueValidationException();
if ($validation) {
  // surface message to the editor form instead of throwing raw
  return $validation->getMessage();
}

Prevention

When it happens

Trigger: In the trigger editor, add an 'Add project tags' rule, leave the tokenizer empty, and save. Also fires when a stored record has value [] and the UI re-validates or applies the trigger.

Common situations: A user picks the rule type but forgets to choose projects; a tokenizer failed to load its datasource so the field silently stayed empty; an API/script client posted an empty value list to the trigger editor.

Related errors


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