{"record":{"id":"87b262556c33eda6","repo":"phacility/phabricator","slug":"err-bad-document-87b262","errorCode":"ERR-BAD-DOCUMENT","errorMessage":"No such document exists.","messagePattern":"No such document exists\\.","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php","lineNumber":51,"sourceCode":"  protected function defineErrorTypes() {\n    return array(\n      'ERR-BAD-DOCUMENT' => pht('No such document exists.'),\n    );\n  }\n\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    $document = id(new PhrictionDocumentQuery())\n      ->setViewer($request->getUser())\n      ->withSlugs(array(PhabricatorSlug::normalize($slug)))\n      ->needContent(true)\n      ->executeOne();\n    if (!$document) {\n      throw new ConduitException('ERR-BAD-DOCUMENT');\n    }\n\n    return $this->buildDocumentInfoDictionary($document);\n  }\n\n}\n","sourceCodeStart":33,"sourceCodeEnd":58,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php#L33-L58","documentation":"phriction.info loads the document (with content) by normalized slug; on miss it raises a ConduitException with error code ERR-BAD-DOCUMENT, declared in defineErrorTypes(). Clients can branch on the structured code instead of parsing the message text.","triggerScenarios":"Calling conduit method phriction.info with a slug that does not exist or that the acting user has no view access to, so the policy-filtered query returns nothing.","commonSituations":"Checking whether a page exists before create/edit; renamed or deleted documents; restricted documents probed by automation users.","solutions":["Confirm the slug in the web UI as the same user","Grant view access if the document should be visible to the caller","Handle ERR-BAD-DOCUMENT in the client as the not-found branch"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $info = $client->callMethodSynchronous('phriction.info', array('slug' => $slug));\n} catch (ConduitClientException $ex) {\n  if ($ex->getErrorCode() === 'ERR-BAD-DOCUMENT') {\n    $info = null; // not found (or hidden): create-if-missing flows go here\n  }\n}","preventionTips":["Use phriction.info as the existence probe in create-if-missing flows","Handle ERR-BAD-DOCUMENT explicitly rather than aborting batches","Confirm the acting user can view the target path"],"tags":["phabricator","phriction","conduit","not-found","err-bad-document"],"backgroundTag":"entity-not-found-by-slug","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}