phacility/phabricator · warning · PhutilArgumentUsageException

Specify at least one import ID to reload.

Error message

Specify at least one import ID to reload.

What it means

Thrown by the bin/calendar import-reload management workflow when no import IDs are given. The workflow takes a wildcard list of IDs; an empty list is rejected immediately because there is nothing to reload.

Source

Thrown at src/applications/calendar/management/PhabricatorCalendarManagementReloadWorkflow.php:29

        pht(
          'Reload event imports from the command line. Useful for '.
          'testing and debugging importers.'))
      ->setArguments(
        array(
          array(
            'name' => 'ids',
            'wildcard' => true,
            'help' => pht('List of import IDs to reload.'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $ids = $args->getArg('ids');
    if (!$ids) {
      throw new PhutilArgumentUsageException(
        pht('Specify at least one import ID to reload.'));
    }

    $imports = id(new PhabricatorCalendarImportQuery())
      ->setViewer($viewer)
      ->withIDs($ids)
      ->execute();
    $imports = mpull($imports, null, 'getID');
    foreach ($ids as $id) {
      if (empty($imports[$id])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Unable to load Calendar import with ID "%s".',
            $id));
      }
    }

    $imports = array_select_keys($imports, $ids);

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass one or more import IDs: 'bin/calendar import-reload 12 15'.
  2. Find valid IDs in Calendar -> Imports (or via the calendar.import.search Conduit method).
  3. Quote/check shell variables before invoking: ensure "$IDS" is non-empty.

Example fix

// before
$ bin/calendar import-reload
// after
$ bin/calendar import-reload 42
Defensive patterns

Strategy: validation

Validate before calling

$ids = array_values(array_filter($args->getArg('ids'), 'is_numeric'));
if (!$ids) {
  fwrite(STDERR, "No import IDs supplied; nothing to reload.\n");
  exit(1);
}
$args->setArg('ids', $ids);

Type guard

function hasImportIds(array $ids) {
  return count(array_filter($ids, 'is_numeric')) > 0;
}

Try / catch

try {
  $workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
  fwrite(STDERR, $ex->getMessage()."\n");
  exit(1);
}

Prevention

When it happens

Trigger: Running 'bin/calendar import-reload' with no arguments; passing an empty array of ids programmatically.

Common situations: Forgetting the ID argument in cron jobs or runbooks; shell variable that expands to nothing ($IDS unset) leaving the command with zero arguments.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/2bffcfbc82035539. Report an issue: GitHub.