phacility/phabricator · warning · Exception

No such AST!

Error message

No such AST!

What it means

The XHPAST demo panel (PhabricatorXHPASTViewPanelController) loads a stored PhabricatorXHPASTParseTree row by its raw numeric id during willProcessRequest(). 'No such AST!' is the not-found signal, thrown as a plain Exception before any rendering happens; it is effectively a 404. The panel allows public access, so anonymous visitors probing ids see it too.

Source

Thrown at src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php:19

<?php

abstract class PhabricatorXHPASTViewPanelController
  extends PhabricatorXHPASTViewController {

  private $id;
  private $storageTree;

  public function shouldAllowPublic() {
    return true;
  }

  public function willProcessRequest(array $data) {
    $this->id = $data['id'];
    $this->storageTree = id(new PhabricatorXHPASTParseTree())
      ->load($this->id);

    if (!$this->storageTree) {
      throw new Exception(pht('No such AST!'));
    }
  }

  protected function getStorageTree() {
    return $this->storageTree;
  }

  protected function buildXHPASTViewPanelResponse($content) {
    $content = hsprintf(
      '<!DOCTYPE html>'.
      '<html>'.
        '<head>'.
          '<style type="text/css">
body {
  white-space: pre;
  font: 10px "Monaco";
  cursor: pointer;
}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Regenerate the AST by submitting code through the XHPAST panel again and use the new id
  2. Verify the row exists in phabricator_xhpast_parsetree if the id is believed valid
  3. Treat it as a 404: no data is corrupted and no action is strictly required
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the tree before emitting or following a panel link.
$tree = id(new PhabricatorXHPASTParseTree())->load($id);
if (!$tree) {
  return new Aphront404Response();
}

Type guard

function xhpastTreeExists($id) {
  return (bool)id(new PhabricatorXHPASTParseTree())->load($id);
}

Try / catch

try {
  $response = $this->handlePanelRequest($request);
} catch (Exception $ex) {
  if (strpos($ex->getMessage(), 'No such AST!') !== false) {
    return new Aphront404Response();
  }
  throw $ex;
}

Prevention

When it happens

Trigger: Visiting the XHPAST view panel with an id that has no phabricator_xhpast_parsetree row: a stale link to a garbage-collected tree, a database reset while old URLs persist, or a crawler probing sequential ids.

Common situations: Old bookmarks or pasted links to parsed AST dumps after the row was pruned; instance re-imports that dropped the xhpast tables; link scanners hitting the public panel.

Related errors


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