phacility/phabricator · error · Exception
Invalid effect!
Error message
Invalid effect!
What it means
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.
Source
Thrown at src/view/phui/PHUIObjectItemView.php:336
$item_classes[] = 'phui-oi-disabled';
} else {
$item_classes[] = 'phui-oi-enabled';
}
switch ($this->effect) {
case 'highlighted':
$item_classes[] = 'phui-oi-highlighted';
break;
case 'selected':
$item_classes[] = 'phui-oi-selected';
break;
case 'visited':
$item_classes[] = 'phui-oi-visited';
break;
case null:
break;
default:
throw new Exception(pht('Invalid effect!'));
}
if ($this->isForbidden) {
$item_classes[] = 'phui-oi-forbidden';
} else if ($this->isSelected) {
$item_classes[] = 'phui-oi-selected';
}
if ($this->selectableName !== null && !$this->isForbidden) {
$item_classes[] = 'phui-oi-selectable';
$sigils[] = 'phui-oi-selectable';
Javelin::initBehavior('phui-selectable-list');
}
$is_grippable = $this->getGrippable();
if ($is_grippable !== null) {
$item_classes[] = 'phui-oi-has-grip';View on GitHub (pinned to 5720a38cfe)
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.
Example fix
// before
$item->setEffect('hilighted'); // typo: throws at render
// after
$item->setEffect('highlighted'); Defensive patterns
Strategy: type-guard
Validate before calling
$valid_effects = array('highlighted', 'selected', 'visited', null);
if (in_array($effect, $valid_effects, true)) {
$item->setEffect($effect);
} Type guard
function isValidObjectItemEffect($effect) {
return in_array(
$effect,
array('highlighted', 'selected', 'visited', null),
true);
} Prevention
- 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.
When it happens
Trigger: $item->setEffect('important'), setEffect('hilighted'), or passing any string not in the effect switch, then rendering the item list.
Common situations: 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.
Related errors
- Unknown condition "%s"!
- Incorrect Property Passed
- Limit 3 actions per item.
- Service "%s" is unrecognized, restricted, or you do not have
- When creating a new Almanac interface via the Conduit API, y
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/9023de9c5a3f631d.
Report an issue: GitHub.