{"record":{"id":"31019455156950c5","repo":"phacility/phabricator","slug":"err-bad-revision-310194","errorCode":"ERR-BAD-REVISION","errorMessage":"ERR-BAD-REVISION","messagePattern":"ERR-BAD-REVISION","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php","lineNumber":57,"sourceCode":"        'A file path was not provided.'),\n      'ERR-BAD-FILE'     => pht(\n        \"Requested file doesn't exist in this revision.\"),\n    );\n  }\n\n  protected function execute(ConduitAPIRequest $request) {\n    $rid = $request->getValue('revisionID');\n    $did = $request->getValue('diffID');\n\n    if ($rid) {\n      // Given both a revision and a diff, check that they match.\n      // Given only a revision, find the active diff.\n      $revision = id(new DifferentialRevisionQuery())\n        ->setViewer($request->getUser())\n        ->withIDs(array($rid))\n        ->executeOne();\n      if (!$revision) {\n        throw new ConduitException('ERR-BAD-REVISION');\n      }\n\n      if (!$did) { // did not!\n        $diff = $revision->loadActiveDiff();\n        $did = $diff->getID();\n      } else { // did too!\n        $diff = id(new DifferentialDiff())->load($did);\n        if (!$diff || $diff->getRevisionID() != $rid) {\n          throw new ConduitException('ERR-BAD-DIFF');\n        }\n      }\n    } else if ($did) {\n      // Given only a diff, find the parent revision.\n      $diff = id(new DifferentialDiff())->load($did);\n      if (!$diff) {\n        throw new ConduitException('ERR-BAD-DIFF');\n      }\n      $rid = $diff->getRevisionID();","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php#L39-L75","documentation":"Thrown by the differential.createinline Conduit method. When revisionID is provided, the method loads the revision with a policy-filtered DifferentialRevisionQuery; if no visible revision matches, it throws ConduitException('ERR-BAD-REVISION'). This happens before any diff resolution or inline-comment creation.","triggerScenarios":"Calling differential.createinline with a truthy revisionID that does not exist, is 'D'-prefixed, or names a revision the acting user cannot see.","commonSituations":"Automated review bots attaching inline comments using revision IDs from older runs; restricted-space revisions; passing a PHID instead of the numeric ID.","solutions":["Send revisionID as the bare integer and verify it first with differential.query","Ensure the conduit token's user can see the revision","Alternatively omit revisionID and pass only diffID - the server resolves the revision from the diff","Catch ERR-BAD-REVISION in batch comment jobs and continue with remaining items"],"exampleFix":"// before\n$params = array(\n  'revisionID' => 'D789',\n  'filePath' => 'src/app.php',\n  'content' => 'Wrong order.',\n);\n\n// after\n$params = array(\n  'revisionID' => 789,\n  'filePath' => 'src/app.php',\n  'content' => 'Wrong order.',\n);","handlingStrategy":"try-catch","validationCode":"$found = $client->callMethodSynchronous(\n  'differential.query',\n  array('ids' => array((int)$rid)));\nif (!$found) {\n  return; // cannot attach inline to unknown revision\n}","typeGuard":null,"tryCatchPattern":"try {\n  $client->callMethodSynchronous('differential.createinline', $params);\n} catch (ConduitClientException $ex) {\n  if ($ex->getErrorCode() === 'ERR-BAD-REVISION') {\n    // revisionID wrong or invisible: log and skip\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Cast revisionID to int and pre-check with differential.query","Bots should re-resolve revision IDs per run, never cache them","Ensure the token's user can see the target revision"],"tags":["phabricator","conduit","differential","inline-comment","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}