{"record":{"id":"a4a7a42011af332a","repo":"phacility/phabricator","slug":"invalid-changeset-id-s","errorCode":null,"errorMessage":"Invalid changeset ID \"%s\"!","messagePattern":"Invalid changeset ID \"(.+?)\"!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/differential/controller/DifferentialInlineCommentEditController.php","lineNumber":46,"sourceCode":"    }\n\n    return $revision;\n  }\n\n  protected function createComment() {\n    // Verify revision and changeset correspond to actual objects, and are\n    // connected to one another.\n    $changeset_id = $this->getChangesetID();\n    $viewer = $this->getViewer();\n\n    $revision = $this->loadRevision();\n\n    $changeset = id(new DifferentialChangesetQuery())\n      ->setViewer($viewer)\n      ->withIDs(array($changeset_id))\n      ->executeOne();\n    if (!$changeset) {\n      throw new Exception(\n        pht(\n          'Invalid changeset ID \"%s\"!',\n          $changeset_id));\n    }\n\n    $diff = $changeset->getDiff();\n    if ($diff->getRevisionID() != $revision->getID()) {\n      throw new Exception(\n        pht(\n          'Changeset ID \"%s\" is part of diff ID \"%s\", but that diff '.\n          'is attached to revision \"%s\", not revision \"%s\".',\n          $changeset_id,\n          $diff->getID(),\n          $diff->getRevisionID(),\n          $revision->getID()));\n    }\n\n    return id(new DifferentialInlineComment())","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/controller/DifferentialInlineCommentEditController.php#L28-L64","documentation":"After the revision resolves, the controller loads the changeset named by the changeset id. A null, wrong, or deleted changeset ID throws 'Invalid changeset ID'. The most common source is a stale page that still references changesets from an older diff of the revision.","triggerScenarios":"Inline comment requests whose changeset id does not exist or is invisible: posting from a page rendered before the diff was replaced or deleted, or constructing requests manually.","commonSituations":"Commenting from a stale diff view after the author updated the revision; automation replaying captured inline-comment requests against new revisions.","solutions":["Reload the revision and diff view, then re-submit the comment.","Ensure the changeset id comes from the same diff you are viewing.","In automation, resolve changeset IDs from the current diff via the API, never from cached pages."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // submit the inline comment with revision id + changeset id\n} catch (Exception $ex) {\n  if (preg_match('/Invalid changeset ID/', $ex->getMessage())) {\n    // stale view: reload the diff and resubmit with a current changeset id\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Take the changeset id from the diff currently rendered, not from a cached page.","Reload the revision view after the author updates the diff.","In automation, resolve changeset ids from the current diff via the API."],"tags":["phabricator","differential","inline-comment","changeset"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}