{"record":{"id":"d0676259fd51a342","repo":"phacility/phabricator","slug":"no-source-exists-with-a-name-matching-s","errorCode":null,"errorMessage":"No source exists with a name matching \"%s\".","messagePattern":"No source exists with a name matching \"(.+?)\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/nuance/management/NuanceManagementWorkflow.php","lineNumber":53,"sourceCode":"      switch ($kind) {\n        case 'id':\n          $message = pht(\n            'No source exists with ID \"%s\".',\n            $source);\n          break;\n        case 'phid':\n          $message = pht(\n            'No source exists with PHID \"%s\".',\n            $source);\n          break;\n        default:\n          $message = pht(\n            'No source exists with a name matching \"%s\".',\n            $source);\n          break;\n      }\n\n      throw new PhutilArgumentUsageException($message);\n    } else if (count($sources) > 1) {\n      $message = pht(\n        'More than one source matches \"%s\". Choose a narrower query, or '.\n        'use an ID or PHID to select a source. Matching sources: %s.',\n        $source,\n        implode(', ', mpull($sources, 'getName')));\n\n      throw new PhutilArgumentUsageException($message);\n    }\n\n    return head($sources);\n  }\n\n  protected function loadITem(PhutilArgumentParser $argv, $key) {\n    $item = $argv->getArg($key);\n    if (!strlen($item)) {\n      throw new PhutilArgumentUsageException(\n        pht(","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/nuance/management/NuanceManagementWorkflow.php#L35-L71","documentation":"The fallback case of loadSource()'s empty-result switch: the selector was neither all digits nor a PHID, so it was treated as a human-readable source NAME (name-matching query), and no Nuance source name matched. Note this fires only when zero sources matched — a name matching multiple sources takes the separate 'More than one source matches' branch instead.","triggerScenarios":"Running a nuance command with --source <name> where the name query (NuanceSourceQuery with a name constraint) returns empty: typo in the name, wrong case/spelling, renamed source, or whitespace/newline contamination in the shell argument.","commonSituations":"Renaming sources in the UI and leaving scripts on the old name; freehand typing names instead of copying; trailing newline in $(cat file) style argument construction; names containing emoji/unicode mangled by terminal encoding.","solutions":["List source names (Nuance UI or list command) and rerun with an exact copy of the name.","Prefer ID or PHID selectors in automation — names are user-editable and drift.","Quote the argument and strip whitespace in scripts: --source \"$(printf '%s' \"$NAME\" | tr -d '[:space:]')\" if contamination is possible.","If the source was renamed, update the script to the new name."],"exampleFix":"# before:\n# bin/nuance import --source \"supportdesk \"   # trailing space, no match\n# -> err: 'No source exists with a name matching \"supportdesk \".'\n\n# after:\n# bin/nuance import --source \"supportdesk\"","handlingStrategy":"validation","validationCode":"// For name selectors, match exactly what the query will match:\n$trimmed = trim((string)$source_selector);\nif ($trimmed !== $source_selector || $trimmed === '') {\n  // contaminated selector: normalize before invoking the CLI\n}\n$exists = id(new NuanceSourceQuery())\n  ->setViewer($viewer)\n  ->withNames(array($trimmed))\n  ->execute();\nif (count($exists) === 0) {\n  // no such name: fetch the current name list instead of guessing\n} elseif (count($exists) > 1) {\n  // ambiguous: switch to an ID or PHID selector\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer ID/PHID selectors in automation; names are editable and drift.","Trim whitespace/newlines from name values built from files or variables.","When renaming a source, update every script that addresses it by name."],"tags":["nuance","cli","entity-not-found","name-lookup","usage-error"],"backgroundTag":"entity-not-found-by-name","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}