phacility/phabricator · error · PhutilArgumentUsageException

Too many arguments: expected only a configuration key when…

Error message

Too many arguments: expected only a configuration key when using "--stdin".

What it means

Usage guard in the config set CLI workflow: fires when --stdin is used together with more than one positional argument. When reading the value from stdin, only the configuration key itself may be given on the command line, so extra arguments abort the run.

Solutions

  1. Pass only the key and pipe the value in: echo <value> | bin/config set --stdin <key>
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php:45 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/2c27326a8b38a1e7. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php:45

            'wildcard'  => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $argv = $args->getArg('args');
    if (!$argv) {
      throw new PhutilArgumentUsageException(
        pht('Specify the configuration key you want to set.'));
    }

    $is_stdin = $args->getArg('stdin');

    $key = $argv[0];

    if ($is_stdin) {
      if (count($argv) > 1) {
        throw new PhutilArgumentUsageException(
          pht(
            'Too many arguments: expected only a configuration key when '.
            'using "--stdin".'));
      }

      fprintf(STDERR, tsprintf("%s\n", pht('Reading value from stdin...')));
      $value = file_get_contents('php://stdin');
    } else {
      if (count($argv) == 1) {
        throw new PhutilArgumentUsageException(
          pht(
            'Specify a value to set the configuration key "%s" to, or '.
            'use "--stdin" to read a value from stdin.',
            $key));
      }

      if (count($argv) > 2) {
        throw new PhutilArgumentUsageException(

View on GitHub (pinned to 5720a38cfe)