phacility/phabricator · error · Exception

Limit 3 actions per item.

Error message

Limit 3 actions per item.

What it means

PHUIObjectItemView::addAction() enforces a hard cap of three actions per object item: the row CSS is generated per action count ('phui-oi-with-N-actions') and only styles up to three, so more would break the layout. Unlike most view errors, this one throws at addAction() time, immediately, not at render time.

Source

Thrown at src/view/phui/PHUIObjectItemView.php:202

  public function setClickable($clickable) {
    $this->clickable = $clickable;
    return $this;
  }

  public function getClickable() {
    return $this->clickable;
  }

  public function setEpoch($epoch) {
    $date = phabricator_dual_datetime($epoch, $this->getUser());
    $this->addIcon('none', $date);
    return $this;
  }

  public function addAction(PHUIListItemView $action) {
    if (count($this->actions) >= 3) {
      throw new Exception(pht('Limit 3 actions per item.'));
    }
    $this->actions[] = $action;
    return $this;
  }

  public function addIcon($icon, $label = null, $attributes = array()) {
    $this->icons[] = array(
      'icon'  => $icon,
      'label' => $label,
      'attributes' => $attributes,
    );
    return $this;
  }

  public function newMenuItem() {
    if (!$this->menu) {
      $this->menu = new FuelMenuView();
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Keep only the three most important actions on the item and move the rest to the object detail page.
  2. Guard or bound the adds: array_slice($actions, 0, 3) or a counter check before each addAction().
  3. Rethink the row design: a crowded action row usually wants a single link to the detail page instead.

Example fix

// before
foreach ($actions as $action) {
  $item->addAction($action); // throws on the 4th action
}

// after
foreach (array_slice($actions, 0, 3) as $action) {
  $item->addAction($action);
}
// surface the remaining actions on the object detail page
Defensive patterns

Strategy: validation

Validate before calling

$added = 0;
foreach ($actions as $action) {
  if ($added >= 3) {
    break; // PHUIObjectItemView hard-caps actions at 3
  }
  $item->addAction($action);
  $added++; 
}

Prevention

When it happens

Trigger: Calling $item->addAction(...) a fourth time — typically an unbounded loop over an action list, or several subsystems each appending actions to rows that already have three.

Common situations: Object lists where each row accumulates edit/subscribe/comment/merge style links; porting an interface that had 4-5 links per row; conditional branches that each add actions without counting.

Related errors


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