{"record":{"id":"9023de9c5a3f631d","repo":"phacility/phabricator","slug":"invalid-effect","errorCode":null,"errorMessage":"Invalid effect!","messagePattern":"Invalid effect!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/view/phui/PHUIObjectItemView.php","lineNumber":336,"sourceCode":"      $item_classes[] = 'phui-oi-disabled';\n    } else {\n      $item_classes[] = 'phui-oi-enabled';\n    }\n\n    switch ($this->effect) {\n      case 'highlighted':\n        $item_classes[] = 'phui-oi-highlighted';\n        break;\n      case 'selected':\n        $item_classes[] = 'phui-oi-selected';\n        break;\n      case 'visited':\n        $item_classes[] = 'phui-oi-visited';\n        break;\n      case null:\n        break;\n      default:\n        throw new Exception(pht('Invalid effect!'));\n    }\n\n    if ($this->isForbidden) {\n      $item_classes[] = 'phui-oi-forbidden';\n    } else if ($this->isSelected) {\n      $item_classes[] = 'phui-oi-selected';\n    }\n\n    if ($this->selectableName !== null && !$this->isForbidden) {\n      $item_classes[] = 'phui-oi-selectable';\n      $sigils[] = 'phui-oi-selectable';\n\n      Javelin::initBehavior('phui-selectable-list');\n    }\n\n    $is_grippable = $this->getGrippable();\n    if ($is_grippable !== null) {\n      $item_classes[] = 'phui-oi-has-grip';","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/view/phui/PHUIObjectItemView.php#L318-L354","documentation":"PHUIObjectItemView::setEffect() accepts exactly four values: 'highlighted', 'selected', 'visited', or null (no effect). During rendering, a switch maps these to CSS classes and its default case throws for anything else — a typo like 'hilighted', a CSS class name like 'phui-oi-highlighted', a color name, or a legacy value that no longer exists.","triggerScenarios":"$item->setEffect('important'), setEffect('hilighted'), or passing any string not in the effect switch, then rendering the item list.","commonSituations":"Copy-pasting effect names from CSS class names instead of the switch in the view; custom forks adding a visual state without extending the switch; upgrades where an effect keyword was removed.","solutions":["Use one of the supported values: 'highlighted', 'selected', 'visited', or null.","For selection state prefer the dedicated setters setSelected(true) / setForbidden(true) instead of an effect.","If a genuinely new visual state is needed, extend the effect switch in a subclass rather than passing unknown strings."],"exampleFix":"// before\n$item->setEffect('hilighted'); // typo: throws at render\n\n// after\n$item->setEffect('highlighted');","handlingStrategy":"type-guard","validationCode":"$valid_effects = array('highlighted', 'selected', 'visited', null);\nif (in_array($effect, $valid_effects, true)) {\n  $item->setEffect($effect);\n}","typeGuard":"function isValidObjectItemEffect($effect) {\n  return in_array(\n    $effect,\n    array('highlighted', 'selected', 'visited', null),\n    true);\n}","tryCatchPattern":null,"preventionTips":["Copy effect keywords from the effect switch in PHUIObjectItemView, not from CSS class names.","Selection state has dedicated setters (setSelected, setForbidden) — prefer those over effects.","Use strict in_array() checks when effects come from config or user input."],"tags":["php","phabricator","object-item","effect","enum"],"backgroundTag":"invalid-effect-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}