{"record":{"id":"7371c67bc6e70aee","repo":"phacility/phabricator","slug":"failed-to-load-comment-s","errorCode":null,"errorMessage":"Failed to load comment \"%s\".","messagePattern":"Failed to load comment \"(.+?)\"\\.","errorType":"http","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/infrastructure/diff/PhabricatorInlineCommentController.php","lineNumber":384,"sourceCode":"\n    // NOTE: This isn't necessarily a DifferentialChangeset ID, just an\n    // application identifier for the changeset. In Diffusion, it's a Path ID.\n    $this->changesetID = $request->getInt('changesetID');\n\n    $this->isNewFile = (int)$request->getBool('is_new');\n    $this->isOnRight = $request->getBool('on_right');\n    $this->lineNumber = $request->getInt('number');\n    $this->lineLength = $request->getInt('length');\n    $this->commentID = $request->getInt('id');\n    $this->operation = $request->getStr('op');\n    $this->renderer = $request->getStr('renderer');\n    $this->replyToCommentPHID = $request->getStr('replyToCommentPHID');\n\n    if ($this->getReplyToCommentPHID()) {\n      $reply_phid = $this->getReplyToCommentPHID();\n      $reply_comment = $this->loadCommentByPHID($reply_phid);\n      if (!$reply_comment) {\n        throw new Exception(\n          pht('Failed to load comment \"%s\".', $reply_phid));\n      }\n\n      // When replying, force the new comment into the same location as the\n      // old comment. If we don't do this, replying to a ghost comment from\n      // diff A while viewing diff B can end up placing the two comments in\n      // different places while viewing diff C, because the porting algorithm\n      // makes a different decision. Forcing the comments to bind to the same\n      // place makes sure they stick together no matter which diff is being\n      // viewed. See T10562 for discussion.\n\n      $this->changesetID = $reply_comment->getChangesetID();\n      $this->isNewFile = $reply_comment->getIsNewFile();\n      $this->lineNumber = $reply_comment->getLineNumber();\n      $this->lineLength = $reply_comment->getLineLength();\n    }\n  }\n","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/diff/PhabricatorInlineCommentController.php#L366-L402","documentation":"Thrown when processing an inline-comment request whose `replyToCommentPHID` parameter does not resolve to a loadable comment. The controller loads the parent comment to clone its location (changeset ID, line, etc.) so replies stay anchored to the original; if the PHID fails to load — nonexistent, deleted, or invisible to the viewer — the controller throws. loadCommentByPHID runs through the subclass's query with the acting viewer, so policy filtering applies.","triggerScenarios":"POSTing an inline reply where `replyToCommentPHID` is a stale, deleted, or malformed PHID; replying to a ghost comment whose original was deleted; a draft replay in the browser carrying an outdated PHID from local storage; requests forged or hand-built with an arbitrary PHID string.","commonSituations":"Long-lived review pages where the parent comment was removed before the reply was submitted; multi-user reviews where policy hides the parent from the replier; browser extensions or automation that cache form state across days.","solutions":["Reload the diff/review page and reply from the fresh comment thread so the client sends a current PHID","Verify the parent comment still exists and is visible to the replying user","Clear stale comment drafts (feedback icons / transaction drafts) if the browser keeps replaying an old reply target"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Client-side, before submitting a reply\nif (!phidRegexpMatch(replyToCommentPHID)) {\n  // drop the stale reply target and submit as a fresh comment instead\n  delete replyToCommentPHID from form payload;\n}","typeGuard":"function isPhid($value) {\n  return is_string($value)\n    && (bool) preg_match('/^PHID-[A-Z]{4}-[a-z0-9]{8,}$/', $value);\n}","tryCatchPattern":null,"preventionTips":["Do not persist replyToCommentPHID in drafts across long sessions; re-resolve the thread on page load","Handle deleted parents gracefully in custom UIs: fall back to a new top-level comment instead of erroring"],"tags":["phabricator","inline-comments","code-review","not-found","reply"],"backgroundTag":"record-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}