phacility/phabricator · error · Exception

View '%s' does not support children.

Error message

View '%s' does not support children.

What it means

AphrontView::appendChild() only works on views that accept children, as decided by canAppendChild(). The base class returns true, but structured container views override it to return false — e.g. PHUIListView, PHUICrumbsView, PHUIPropertyListView, PHUITabGroupView and PHUIStatusListView — because their items must be added through typed APIs (addMenuItem(), addCrumb(), addProperty(), addTab()). Appending an arbitrary renderable to such a view throws immediately, at append time rather than render time.

Source

Thrown at src/view/AphrontView.php:109

   */
  protected function canAppendChild() {
    return true;
  }


  /**
   * Append a child to the list of children.
   *
   * This method will only work if the view supports children, which is
   * determined by @{method:canAppendChild}.
   *
   * @param  wild   Something renderable.
   * @return this
   */
  final public function appendChild($child) {
    if (!$this->canAppendChild()) {
      $class = get_class($this);
      throw new Exception(
        pht("View '%s' does not support children.", $class));
    }

    $this->children[] = $child;

    return $this;
  }


  /**
   * Produce children for rendering.
   *
   * Historically, this method reduced children to a string representation,
   * but it no longer does.
   *
   * @return wild Renderable children.
   * @task
   */

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Identify the container class named in the message and use its typed API: addMenuItem() for menus, addCrumb() for crumbs, addProperty() for property lists, addTab() for tab groups.
  2. Wrap free-form content in a child-capable container (phutil_tag(), PHUIBoxView) and add that through the typed API.
  3. Only if you own the subclass and genuinely want free-form children, override canAppendChild() to return true — rarely the right design for structured lists.

Example fix

// before
$list = id(new PHUIListView());
$list->appendChild($extra); // throws: PHUIListView does not support children

// after
$list = id(new PHUIListView());
$list->addMenuItem($extra_item); // PHUIListItemView
Defensive patterns

Strategy: try-catch

Type guard

// canAppendChild() is protected, so narrow by known classes:
// PHUIListView, PHUICrumbsView, PHUIPropertyListView, PHUITabGroupView,
// PHUIStatusListView all reject children.
function acceptsChildren($view) {
  $no_children = array(
    'PHUIListView',
    'PHUICrumbsView',
    'PHUIPropertyListView',
    'PHUITabGroupView',
    'PHUIStatusListView',
  );
  return !in_array(get_class($view), $no_children, true);
}

Try / catch

try {
  $view->appendChild($child);
} catch (Exception $ex) {
  // Structured view: does not take free-form children;
  // render through a generic container instead.
  $html = phutil_tag('div', array(), array($view, $child));
}

Prevention

When it happens

Trigger: Calling appendChild($child) on a menu list, crumbs bar, property list, tab group, or status list instead of using the typed add*() method, e.g. $list->appendChild($item) on a PHUIListView.

Common situations: Treating every PHUI* object as a generic container while assembling custom UI; porting older phutil_tag/div-based markup into view objects; using the wrong component (a structured list where a PHUIBoxView or plain phutil_tag container was intended).

Related errors


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