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.
Solutions
- Keep only the three most important actions on the item and move the rest to the object detail page.
- Guard or bound the adds: array_slice($actions, 0, 3) or a counter check before each addAction().
- 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
- Treat 3 as a design constraint, not just a runtime check: cut actions per row.
- Track counts when multiple subsystems contribute actions to one item.
- Move overflow actions to the object detail page.
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
- Invalid effect!
- Absolute TTL must be in the present or future, but TTL
- Add project rule value should be a list, but is not
- All members of the account
- All of the configured Fulltext Search services failed.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/c55c21150ccf69fd.
Report an issue: GitHub.
Appendix: 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)