{"record":{"id":"e06cf229ee8c1956","repo":"phacility/phabricator","slug":"this-event-instance-has-not-been-created-yet-log","errorCode":null,"errorMessage":"This event instance has not been created yet. Log in to create it.","messagePattern":"This event instance has not been created yet\\. Log in to create it\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/calendar/controller/PhabricatorCalendarEventViewController.php","lineNumber":580,"sourceCode":"    if ($event->isChildEvent()) {\n      $event = $event->getParentEvent();\n    }\n\n    // Try to load the instance. If it already exists, we're all done and\n    // can just return it.\n    $instance = id(new PhabricatorCalendarEventQuery())\n      ->setViewer($viewer)\n      ->withInstanceSequencePairs(\n        array(\n          array($event->getPHID(), $sequence),\n        ))\n      ->executeOne();\n    if ($instance) {\n      return $instance;\n    }\n\n    if (!$viewer->isLoggedIn()) {\n      throw new Exception(\n        pht(\n          'This event instance has not been created yet. Log in to create '.\n          'it.'));\n    }\n\n    if (!$event->isValidSequenceIndex($viewer, $sequence)) {\n      return null;\n    }\n\n    return $event->newStub($viewer, $sequence);\n  }\n\n  private function buildSubheaderView(PhabricatorCalendarEvent $event) {\n    $viewer = $this->getViewer();\n\n    $host_phid = $event->getHostPHID();\n\n    $handles = $viewer->loadHandles(array($host_phid));","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php#L562-L598","documentation":"Thrown by the Calendar event view controller when a recurring-event instance (event PHID + sequence number) does not exist yet and the acting viewer is not logged in. Phabricator creates instance stubs lazily on demand, but only for authenticated users; anonymous visitors get this exception instead of a created instance.","triggerScenarios":"An anonymous request to a recurring event instance URI like /E123/45 where sequence 45 has never been generated (no row found by withInstanceSequencePairs, and isLoggedIn() is false). Also API/script hits that carry no session cookie.","commonSituations":"Logged-out users following links to future instances; search-engine crawlers indexing instance URIs; expired sessions; feed/email links to not-yet-created instances.","solutions":["Log in as a registered user and reload the instance URL - the stub is created on demand via newStub().","When generating links, only link to instances that already exist (verify with calendar.event.search Conduit).","For crawlers/anonymous traffic, exclude instance URIs from indexing or route them to a login prompt."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// In a controller or Conduit endpoint, gate before requesting the instance:\nif (!$viewer->isLoggedIn()) {\n  // return a login redirect / 403 response instead of triggering the throw\n  return $this->requireLogin($request)->setConsoleMessage(\n    pht('Log in to view or create event instances.'));\n}\n$instance = $event->newStubIfNeeded($viewer, $sequence);","typeGuard":null,"tryCatchPattern":"try {\n  $instance = $event->loadInstance($viewer, $sequence);\n} catch (Exception $ex) {\n  // anonymous viewer hit a not-yet-created instance\n  return new Aphront404Response();\n}","preventionTips":["Check $viewer->isLoggedIn() before dereferencing instance sequence URIs.","Only publish links to instances that already exist.","Exclude recurring-instance URIs from anonymous crawling in robots.txt or caching rules."],"tags":["phabricator","calendar","auth","recurring-events","lazy-instantiation"],"backgroundTag":"authentication-required","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}