{"record":{"id":"e0a29383bd497f61","repo":"phacility/phabricator","slug":"expected-s","errorCode":null,"errorMessage":"Expected `%s`!","messagePattern":"Expected `(.+?)`!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php","lineNumber":40,"sourceCode":"          'wildcard' => true,\n        ),\n      ));\n  }\n\n  protected function identifyRepository() {\n    $args = $this->getArgs();\n    $path = $args->getArg('repository');\n    return $this->loadRepositoryWithPath(\n      $path,\n      PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL);\n  }\n\n  protected function executeRepositoryOperations() {\n    $repository = $this->getRepository();\n    $args = $this->getArgs();\n\n    if (!$args->getArg('stdio')) {\n      throw new Exception(pht('Expected `%s`!', 'hg ... --stdio'));\n    }\n\n    if ($args->getArg('command') !== array('serve')) {\n      throw new Exception(pht('Expected `%s`!', 'hg ... serve'));\n    }\n\n    if ($this->shouldProxy()) {\n      // NOTE: For now, we're always requesting a writable node. The request\n      // may not actually need one, but we can't currently determine whether\n      // it is read-only or not at this phase of evaluation.\n      $command = $this->getProxyCommand(true);\n    } else {\n      $command = csprintf(\n        'hg -R %s serve --stdio',\n        $repository->getLocalPath());\n    }\n    $command = PhabricatorDaemon::sudoCommandAsDaemonUser($command);\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php#L22-L58","documentation":"The Mercurial SSH workflow expects clients to invoke exactly 'hg -R <path> serve --stdio', the standard hg SSH wire command. After parsing the SSH-side arguments (-R/--repository, --stdio, and a wildcard command), a missing --stdio flag throws this exception.","triggerScenarios":"Hand-running a custom command over the Phabricator SSH endpoint (ssh user@host hg -R /diffusion/X/ serve without --stdio), or a nonstandard or very old Mercurial client that omits the flag.","commonSituations":"Manual ssh debugging sessions; exotic hg wrappers or CI tooling invoking hg directly; hg versions below the supported baseline.","solutions":["Let hg build the command itself: hg clone ssh://user@host/source/<shortname>","Upgrade the Mercurial client to a supported version","Do not run arbitrary hg subcommands through the Phabricator SSH endpoint — only serve --stdio is implemented"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Client side: let hg construct the wire command itself\n// good: hg clone ssh://user@host/source/<shortname>\n// bad:  ssh user@host hg -R /diffusion/X/ serve   (no --stdio)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a stock, supported Mercurial client for clone/push/pull","Do not hand-invoke hg subcommands over the Phabricator SSH endpoint","When debugging ssh manually, reproduce the exact 'hg -R <path> serve --stdio' form"],"tags":["mercurial","ssh","protocol"],"backgroundTag":"vcs-ssh-command-mismatch","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}