phacility/phabricator · error · PhutilArgumentUsageException

Specify exactly one story key to republish.

Error message

Specify exactly one story key to republish.

What it means

CLI usage guard in the feed republish workflow: more than one story key was supplied, but the command accepts exactly one. A PhutilArgumentUsageException indicating extra positional arguments were passed.

Solutions

  1. Pass exactly one story key to the command
  2. Run each republish separately for multiple stories
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/feed/management/PhabricatorFeedManagementRepublishWorkflow.php:31 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/applications/feed/management/PhabricatorFeedManagementRepublishWorkflow.php:31

      ->setArguments(
        array(
          array(
            'name' => 'key',
            'wildcard' => true,
          ),
        ));
  }

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

    $key = $args->getArg('key');
    if (count($key) < 1) {
      throw new PhutilArgumentUsageException(
        pht('Specify a story key to republish.'));
    } else if (count($key) > 1) {
      throw new PhutilArgumentUsageException(
        pht('Specify exactly one story key to republish.'));
    }
    $key = head($key);

    $story = id(new PhabricatorFeedQuery())
      ->setViewer($viewer)
      ->withChronologicalKeys(array($key))
      ->executeOne();

    if (!$story) {
      throw new PhutilArgumentUsageException(
        pht('No story exists with key "%s"!', $key));
    }

    $console->writeOut("%s\n", pht('Republishing story...'));

    PhabricatorWorker::setRunAllTasksInProcess(true);

View on GitHub (pinned to 5720a38cfe)