{"record":{"id":"449aea5b9b344d0a","repo":"phacility/phabricator","slug":"unable-to-load-calendar-import-with-id-s","errorCode":null,"errorMessage":"Unable to load Calendar import with ID \"%s\".","messagePattern":"Unable to load Calendar import with ID \"(.+?)\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/calendar/management/PhabricatorCalendarManagementReloadWorkflow.php","lineNumber":40,"sourceCode":"  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $ids = $args->getArg('ids');\n    if (!$ids) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify at least one import ID to reload.'));\n    }\n\n    $imports = id(new PhabricatorCalendarImportQuery())\n      ->setViewer($viewer)\n      ->withIDs($ids)\n      ->execute();\n    $imports = mpull($imports, null, 'getID');\n    foreach ($ids as $id) {\n      if (empty($imports[$id])) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to load Calendar import with ID \"%s\".',\n            $id));\n      }\n    }\n\n    $imports = array_select_keys($imports, $ids);\n\n    foreach ($imports as $import) {\n      echo tsprintf(\n        \"%s\\n\",\n        pht(\n          'Importing \"%s\"...',\n          $import->getDisplayName()));\n\n      $engine = $import->getEngine();\n\n      $engine->importEventsFromSource($viewer, $import, false);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/calendar/management/PhabricatorCalendarManagementReloadWorkflow.php#L22-L58","documentation":"Thrown by bin/calendar import-reload when one of the given IDs does not resolve to a Calendar import visible to the acting viewer (loaded via PhabricatorCalendarImportQuery). The whole command aborts before reloading anything, even if other IDs were valid.","triggerScenarios":"'bin/calendar import-reload 999999' (nonexistent ID); typo'd ID; import deleted; import not visible to the user running the command (policy filtering); passing an event ID instead of an import ID.","commonSituations":"Copy-pasting the event ID from a URL (/E123) instead of the import ID; imports owned by another user while running the CLI as a non-admin; stale IDs after imports were deleted.","solutions":["Verify each ID in Calendar -> Imports (the URI /calendar/import/ lists them; the ID is the number in /import/NN).","Run the command as an administrator or the import owner if visibility policies block loading.","Drop the offending ID and re-run with only the IDs that load."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-flight the IDs with the same query the workflow uses:\n$imports = id(new PhabricatorCalendarImportQuery())\n  ->setViewer($this->getViewer())\n  ->withIDs($ids)\n  ->execute();\n$loadable = mpull($imports, 'getID');\n$missing = array_diff($ids, $loadable);\nif ($missing) {\n  fwrite(STDERR, 'Skipping unloadable import IDs: '.implode(', ', $missing).\"\\n\");\n}\n$ids = $loadable; // proceed only with what actually loads","typeGuard":null,"tryCatchPattern":"try {\n  $workflow->execute($args);\n} catch (PhutilArgumentUsageException $ex) {\n  // usually a typo'd or policy-hidden ID; print and strip the bad ID\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(1);\n}","preventionTips":["Copy import IDs from /calendar/import/, not event IDs.","Run the workflow as a user who can see every import (admin) in batch jobs.","Pre-flight IDs with the query above so one bad ID does not abort the batch."],"tags":["phabricator","cli","calendar","import","not-found"],"backgroundTag":"record-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}