phacility/phabricator · error · Exception

No such document.

Error message

No such document.

What it means

phriction.edit loads the document by normalized slug with both CAN_VIEW and CAN_EDIT capabilities required; when nothing matches, it throws this plain Exception. Because policy-filtered results look identical to absent ones, a document the caller may view but not edit also produces 'No such document.' rather than a permission error.

Source

Thrown at src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php:43

  protected function execute(ConduitAPIRequest $request) {
    $slug = $request->getValue('slug');
    if ($slug === null || !strlen($slug)) {
      throw new Exception(pht('Field "slug" must be non-empty.'));
    }

    $doc = id(new PhrictionDocumentQuery())
      ->setViewer($request->getUser())
      ->withSlugs(array(PhabricatorSlug::normalize($slug)))
      ->needContent(true)
      ->requireCapabilities(
        array(
          PhabricatorPolicyCapability::CAN_VIEW,
          PhabricatorPolicyCapability::CAN_EDIT,
        ))
      ->executeOne();
    if (!$doc) {
      throw new Exception(pht('No such document.'));
    }

    $xactions = array();
    if ($request->getValue('title')) {
      $xactions[] = id(new PhrictionTransaction())
        ->setTransactionType(
          PhrictionDocumentTitleTransaction::TRANSACTIONTYPE)
        ->setNewValue($request->getValue('title'));
    }

    if ($request->getValue('content')) {
      $xactions[] = id(new PhrictionTransaction())
        ->setTransactionType(
          PhrictionDocumentContentTransaction::TRANSACTIONTYPE)
        ->setNewValue($request->getValue('content'));
    }

    $editor = id(new PhrictionTransactionEditor())

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Open the slug in the web UI as the same user to confirm the document exists and is editable
  2. Grant the acting user edit permission (Phriction application policy or the owning project's policy)
  3. Double-check the slug spelling against the document URL
Defensive patterns

Strategy: try-catch

Validate before calling

// Optional pre-flight: confirm the document resolves for this actor.
$info = $client->callMethodSynchronous('phriction.info', array(
  'slug' => $slug,
));
// ERR-BAD-DOCUMENT from phriction.info covers not-found and no-view;
// edit additionally requires CAN_EDIT, so verify policy separately.

Try / catch

try {
  $result = $client->callMethodSynchronous('phriction.edit', $params);
} catch (Exception $ex) {
  if (strpos($ex->getMessage(), 'No such document') !== false) {
    // either the slug is wrong or the actor lacks edit access; check both
  }
}

Prevention

When it happens

Trigger: Editing a slug that does not exist, or one where the acting conduit user lacks the Phriction edit capability so the policy-filtered query returns nothing.

Common situations: Bot or script users missing edit permission on Phriction or on a specific path's project policy; documents that were deleted; slug misspellings (input is normalized server-side, so wrong words, not formatting, cause misses).

Related errors


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