{"record":{"id":"afe5cd0f865a657b","repo":"phacility/phabricator","slug":"err-not-found","errorCode":"ERR_NOT_FOUND","errorMessage":"ERR_NOT_FOUND","messagePattern":"ERR_NOT_FOUND","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php","lineNumber":50,"sourceCode":"  }\n\n  protected function defineErrorTypes() {\n    return array(\n      'ERR_NOT_FOUND' => pht('Revision was not found.'),\n    );\n  }\n\n  protected function execute(ConduitAPIRequest $request) {\n    $viewer = $request->getUser();\n    $id = $request->getValue('revisionID');\n\n    $revision = id(new DifferentialRevisionQuery())\n      ->withIDs(array($id))\n      ->setViewer($viewer)\n      ->needReviewers(true)\n      ->executeOne();\n    if (!$revision) {\n      throw new ConduitException('ERR_NOT_FOUND');\n    }\n\n    $xactions = array();\n    $xactions[] = id(new DifferentialTransaction())\n      ->setTransactionType(\n        DifferentialRevisionCloseTransaction::TRANSACTIONTYPE)\n      ->setNewValue(true);\n\n    $content_source = $request->newContentSource();\n\n    $editor = id(new DifferentialTransactionEditor())\n      ->setActor($viewer)\n      ->setContentSource($request->newContentSource())\n      ->setContinueOnMissingFields(true)\n      ->setContinueOnNoEffect(true);\n\n    $editor->applyTransactions($revision, $xactions);\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php#L32-L68","documentation":"Thrown by the differential.closerevision Conduit method. It runs a viewer-policy-filtered DifferentialRevisionQuery (with reviewers attached) on the revisionID parameter, then applies a DifferentialRevisionCloseTransaction through DifferentialTransactionEditor. If the query returns no revision (the ID does not exist or the acting user cannot see it), ConduitException('ERR_NOT_FOUND') is thrown before any transaction is applied.","triggerScenarios":"Calling conduit method differential.closerevision with a revisionID that does not exist, passing 'D123' or a PHID instead of the bare integer, passing null/0, or closing a revision hidden from the caller by object or space visibility policy.","commonSituations":"Post-merge automation that closes revisions using IDs scraped from commit messages; bot accounts whose conduit token belongs to a user without visibility on the revision; typos when transcribing revision numbers; the revision was deleted after its ID was captured.","solutions":["Pass revisionID as the bare integer ID (123), not 'D123' and not a PHID","Confirm the revision exists and is visible to the same token by calling differential.query with ids=[id] first","Check the revision's view policy and space in the web UI, and run the call with a token from a user who can see it","In automation, treat ERR_NOT_FOUND as non-fatal: log it and continue instead of aborting the whole hook"],"exampleFix":"// before\n$client->callMethodSynchronous('differential.closerevision', array(\n  'revisionID' => 'D123',\n));\n\n// after\n$client->callMethodSynchronous('differential.closerevision', array(\n  'revisionID' => 123,\n));","handlingStrategy":"try-catch","validationCode":"// PHP conduit client: confirm visibility with the same token first.\n$found = $client->callMethodSynchronous(\n  'differential.query',\n  array('ids' => array((int)$id)));\nif (!$found) {\n  // nothing to close; skip\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  $client->callMethodSynchronous('differential.closerevision',\n    array('revisionID' => (int)$id));\n} catch (ConduitClientException $ex) {\n  if ($ex->getErrorCode() === 'ERR_NOT_FOUND') {\n    // revision absent or invisible: log, continue\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Normalize revision IDs to bare integers (strip the leading 'D') before calling","Pre-check existence with differential.query using the same conduit token","In automation, treat close-not-found as a warning, not a pipeline failure"],"tags":["phabricator","conduit","differential","revision","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}