{"record":{"id":"c55c21150ccf69fd","repo":"phacility/phabricator","slug":"limit-3-actions-per-item","errorCode":null,"errorMessage":"Limit 3 actions per item.","messagePattern":"Limit 3 actions per item\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/view/phui/PHUIObjectItemView.php","lineNumber":202,"sourceCode":"\n  public function setClickable($clickable) {\n    $this->clickable = $clickable;\n    return $this;\n  }\n\n  public function getClickable() {\n    return $this->clickable;\n  }\n\n  public function setEpoch($epoch) {\n    $date = phabricator_dual_datetime($epoch, $this->getUser());\n    $this->addIcon('none', $date);\n    return $this;\n  }\n\n  public function addAction(PHUIListItemView $action) {\n    if (count($this->actions) >= 3) {\n      throw new Exception(pht('Limit 3 actions per item.'));\n    }\n    $this->actions[] = $action;\n    return $this;\n  }\n\n  public function addIcon($icon, $label = null, $attributes = array()) {\n    $this->icons[] = array(\n      'icon'  => $icon,\n      'label' => $label,\n      'attributes' => $attributes,\n    );\n    return $this;\n  }\n\n  public function newMenuItem() {\n    if (!$this->menu) {\n      $this->menu = new FuelMenuView();\n    }","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/view/phui/PHUIObjectItemView.php#L184-L220","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nforeach ($actions as $action) {\n  $item->addAction($action); // throws on the 4th action\n}\n\n// after\nforeach (array_slice($actions, 0, 3) as $action) {\n  $item->addAction($action);\n}\n// surface the remaining actions on the object detail page","handlingStrategy":"validation","validationCode":"$added = 0;\nforeach ($actions as $action) {\n  if ($added >= 3) {\n    break; // PHUIObjectItemView hard-caps actions at 3\n  }\n  $item->addAction($action);\n  $added++; \n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["php","phabricator","object-item","actions","ui-limits"],"backgroundTag":"action-limit-exceeded","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}