{"record":{"id":"0296e6d2844f80cb","repo":"phacility/phabricator","slug":"argument-s-is-ambiguous-and-matches-multiple-g","errorCode":null,"errorMessage":"Argument \"%s\" is ambiguous, and matches multiple generators: %s.","messagePattern":"Argument \"(.+?)\" is ambiguous, and matches multiple generators: (.+?)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php","lineNumber":119,"sourceCode":"            $matches = array($generator);\n            break;\n          }\n\n          // If there's a partial match, match that generator but continue.\n          if (strpos($name, $arg) !== false) {\n            $matches[] = $generator;\n          }\n        }\n\n        if (!$matches) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Argument \"%s\" does not match the name of any generators.',\n              $arg_original));\n        }\n\n        if (count($matches) > 1) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Argument \"%s\" is ambiguous, and matches multiple '.\n              'generators: %s.',\n              $arg_original,\n              implode(', ', mpull($matches, 'getGeneratorName'))));\n        }\n      }\n\n      foreach ($matches as $match) {\n        $generators[] = $match;\n      }\n    }\n\n    $generators = mpull($generators, null, 'getGeneratorKey');\n\n    echo tsprintf(\n      \"**<bg:blue> %s </bg>** %s\\n\",\n      pht('GENERATORS'),","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php#L101-L137","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using convenient abbreviations instead of full keys; adding a custom generator whose key contains an existing key as a substring, breaking old scripts.","solutions":["Use the full, exact generator key for the generator you want (see the names in the error message).","Name custom generators with keys that do not substring-collide with existing ones."],"exampleFix":"// before\n./bin/lipsum generate user   // matches multiple generators\n// after\n./bin/lipsum generate users  // exact generator key","handlingStrategy":"validation","validationCode":"// Reject ambiguous prefixes before invoking lipsum:\n$matches = array();\nforeach ($keys as $key) {\n  if (strpos($key, strtolower($arg)) !== false) { $matches[] = $key; }\n}\nif (count($matches) !== 1) {\n  throw new InvalidArgumentException(\n    'Ambiguous or unknown generator; candidates: '.implode(', ', $matches));\n}","typeGuard":"function isUniqueLipsumGeneratorPrefix($arg) {\n  $matches = array_filter($keys, function($k) use ($arg) {\n    return strpos($k, strtolower($arg)) !== false;\n  });\n  return count($matches) === 1;\n}","tryCatchPattern":null,"preventionTips":["Always use full generator keys in scripts; avoid prefix shorthand.","Name custom generators with keys that are not substrings of existing keys."],"tags":["lipsum","phabricator","cli","ambiguous-match","generator"],"backgroundTag":"ambiguous-argument-match","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}