phacility/phabricator · warning · PhutilArgumentUsageException

Argument "%s" is ambiguous, and matches multiple generators:

Error message

Argument "%s" is ambiguous, and matches multiple generators: %s.

What it means

When no exact key match exists, lipsum collects every generator key containing the argument as a substring; if more than one matches, the command cannot choose and aborts, listing the matching generators' display names so you can disambiguate.

Source

Thrown at src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php:119

            $matches = array($generator);
            break;
          }

          // If there's a partial match, match that generator but continue.
          if (strpos($name, $arg) !== false) {
            $matches[] = $generator;
          }
        }

        if (!$matches) {
          throw new PhutilArgumentUsageException(
            pht(
              'Argument "%s" does not match the name of any generators.',
              $arg_original));
        }

        if (count($matches) > 1) {
          throw new PhutilArgumentUsageException(
            pht(
              'Argument "%s" is ambiguous, and matches multiple '.
              'generators: %s.',
              $arg_original,
              implode(', ', mpull($matches, 'getGeneratorName'))));
        }
      }

      foreach ($matches as $match) {
        $generators[] = $match;
      }
    }

    $generators = mpull($generators, null, 'getGeneratorKey');

    echo tsprintf(
      "**<bg:blue> %s </bg>** %s\n",
      pht('GENERATORS'),

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use the full, exact generator key for the generator you want (see the names in the error message).
  2. Name custom generators with keys that do not substring-collide with existing ones.

Example fix

// before
./bin/lipsum generate user   // matches multiple generators
// after
./bin/lipsum generate users  // exact generator key
Defensive patterns

Strategy: validation

Validate before calling

// Reject ambiguous prefixes before invoking lipsum:
$matches = array();
foreach ($keys as $key) {
  if (strpos($key, strtolower($arg)) !== false) { $matches[] = $key; }
}
if (count($matches) !== 1) {
  throw new InvalidArgumentException(
    'Ambiguous or unknown generator; candidates: '.implode(', ', $matches));
}

Type guard

function isUniqueLipsumGeneratorPrefix($arg) {
  $matches = array_filter($keys, function($k) use ($arg) {
    return strpos($k, strtolower($arg)) !== false;
  });
  return count($matches) === 1;
}

Prevention

When it happens

Trigger: Running './bin/lipsum generate user' when several keys contain 'user' as a substring (the error message names the colliding generators); short prefixes like 'ta' matching multiple keys.

Common situations: Using convenient abbreviations instead of full keys; adding a custom generator whose key contains an existing key as a substring, breaking old scripts.

Related errors


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