{"record":{"id":"74774e1663540a83","repo":"phacility/phabricator","slug":"no-such-document","errorCode":null,"errorMessage":"No such document.","messagePattern":"No such document\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php","lineNumber":43,"sourceCode":"\n  protected function execute(ConduitAPIRequest $request) {\n    $slug = $request->getValue('slug');\n    if ($slug === null || !strlen($slug)) {\n      throw new Exception(pht('Field \"slug\" must be non-empty.'));\n    }\n\n    $doc = id(new PhrictionDocumentQuery())\n      ->setViewer($request->getUser())\n      ->withSlugs(array(PhabricatorSlug::normalize($slug)))\n      ->needContent(true)\n      ->requireCapabilities(\n        array(\n          PhabricatorPolicyCapability::CAN_VIEW,\n          PhabricatorPolicyCapability::CAN_EDIT,\n        ))\n      ->executeOne();\n    if (!$doc) {\n      throw new Exception(pht('No such document.'));\n    }\n\n    $xactions = array();\n    if ($request->getValue('title')) {\n      $xactions[] = id(new PhrictionTransaction())\n        ->setTransactionType(\n          PhrictionDocumentTitleTransaction::TRANSACTIONTYPE)\n        ->setNewValue($request->getValue('title'));\n    }\n\n    if ($request->getValue('content')) {\n      $xactions[] = id(new PhrictionTransaction())\n        ->setTransactionType(\n          PhrictionDocumentContentTransaction::TRANSACTIONTYPE)\n        ->setNewValue($request->getValue('content'));\n    }\n\n    $editor = id(new PhrictionTransactionEditor())","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Open the slug in the web UI as the same user to confirm the document exists and is editable","Grant the acting user edit permission (Phriction application policy or the owning project's policy)","Double-check the slug spelling against the document URL"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Optional pre-flight: confirm the document resolves for this actor.\n$info = $client->callMethodSynchronous('phriction.info', array(\n  'slug' => $slug,\n));\n// ERR-BAD-DOCUMENT from phriction.info covers not-found and no-view;\n// edit additionally requires CAN_EDIT, so verify policy separately.","typeGuard":null,"tryCatchPattern":"try {\n  $result = $client->callMethodSynchronous('phriction.edit', $params);\n} catch (Exception $ex) {\n  if (strpos($ex->getMessage(), 'No such document') !== false) {\n    // either the slug is wrong or the actor lacks edit access; check both\n  }\n}","preventionTips":["Remember the edit path hides policy denials as not-found: verify the bot's edit permission, not just existence","Keep a canonical slug registry in client code to avoid typos","Test conduit bot users against a known document before relying on them"],"tags":["phabricator","phriction","conduit","slug","not-found","policy"],"backgroundTag":"entity-not-found-by-slug","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}