{"record":{"id":"2e6941a969ac84cc","repo":"phacility/phabricator","slug":"err-not-found-2e6941","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/DifferentialGetCommitMessageConduitAPIMethod.php","lineNumber":46,"sourceCode":"  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    $id = $request->getValue('revision_id');\n    $viewer = $request->getUser();\n\n    if ($id) {\n      $revision = id(new DifferentialRevisionQuery())\n        ->withIDs(array($id))\n        ->setViewer($viewer)\n        ->needReviewers(true)\n        ->needActiveDiffs(true)\n        ->executeOne();\n      if (!$revision) {\n        throw new ConduitException('ERR_NOT_FOUND');\n      }\n    } else {\n      $revision = DifferentialRevision::initializeNewRevision($viewer);\n    }\n\n    // There are three modes here: \"edit\", \"create\", and \"read\" (which has\n    // no value for the \"edit\" parameter).\n\n    // In edit or create mode, we hide read-only fields. In create mode, we\n    // show \"Field:\" templates for some fields even if they are empty.\n    $edit_mode = $request->getValue('edit');\n\n    $is_any_edit = $edit_mode !== null && (bool)strlen($edit_mode);\n    $is_create = ($edit_mode == 'create');\n\n    $field_list = DifferentialCommitMessageField::newEnabledFields($viewer);\n\n    $custom_storage = $this->loadCustomFieldStorage($viewer, $revision);","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php#L28-L64","documentation":"Thrown by the differential.getcommitmessage Conduit method. When the revision_id parameter is truthy, the method loads that revision (policy-filtered, with reviewers and active diffs) to render its commit message; if no revision matches, ConduitException('ERR_NOT_FOUND') is thrown. When revision_id is empty the method instead builds a template from a fresh revision, so the error only occurs in the lookup branch.","triggerScenarios":"Calling differential.getcommitmessage with a nonexistent revision_id, a 'D'-prefixed string, or an ID invisible to the caller's policy; also edit=true flows where arc tries to fetch a message for an ID that was never uploaded.","commonSituations":"arc workflows referencing a revision number from an unpushed or deleted branch; scripts generating commit messages in bulk where some revisions were removed; tokens lacking space visibility.","solutions":["Send revision_id as a bare integer that you verified with differential.query","For new revisions, omit revision_id and use the create/edit template modes instead","Ensure the conduit token's user can see the revision","Catch ERR_NOT_FOUND and skip message generation for that ID"],"exampleFix":"// before\n$params = array(\n  'revision_id' => 'D12',\n  'edit' => true,\n);\n\n// after\n$params = array(\n  'revision_id' => 12,\n  'edit' => true,\n);","handlingStrategy":"try-catch","validationCode":"if ($rev_id) {\n  $found = $client->callMethodSynchronous('differential.query',\n    array('ids' => array((int)$rev_id)));\n  if (!$found) {\n    $rev_id = null; // fall back to template mode for new revisions\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  $msg = $client->callMethodSynchronous('differential.getcommitmessage',\n    array('revision_id' => (int)$rev_id, 'edit' => true));\n} catch (ConduitClientException $ex) {\n  if ($ex->getErrorCode() === 'ERR_NOT_FOUND') {\n    // unknown/invisible revision: skip message rendering\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Use bare integer revision IDs","Pre-check with differential.query when IDs come from untrusted parsing","Use template mode (no revision_id) for not-yet-created revisions"],"tags":["phabricator","conduit","differential","commit-message","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}