phacility/phabricator · error · Exception
Expected `%s`!
Error message
Expected `%s`!
What it means
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.
Source
Thrown at src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php:40
'wildcard' => true,
),
));
}
protected function identifyRepository() {
$args = $this->getArgs();
$path = $args->getArg('repository');
return $this->loadRepositoryWithPath(
$path,
PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL);
}
protected function executeRepositoryOperations() {
$repository = $this->getRepository();
$args = $this->getArgs();
if (!$args->getArg('stdio')) {
throw new Exception(pht('Expected `%s`!', 'hg ... --stdio'));
}
if ($args->getArg('command') !== array('serve')) {
throw new Exception(pht('Expected `%s`!', 'hg ... serve'));
}
if ($this->shouldProxy()) {
// NOTE: For now, we're always requesting a writable node. The request
// may not actually need one, but we can't currently determine whether
// it is read-only or not at this phase of evaluation.
$command = $this->getProxyCommand(true);
} else {
$command = csprintf(
'hg -R %s serve --stdio',
$repository->getLocalPath());
}
$command = PhabricatorDaemon::sudoCommandAsDaemonUser($command);
View on GitHub (pinned to 5720a38cfe)
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
Defensive patterns
Strategy: validation
Validate before calling
// Client side: let hg construct the wire command itself // good: hg clone ssh://user@host/source/<shortname> // bad: ssh user@host hg -R /diffusion/X/ serve (no --stdio)
Prevention
- 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
When it happens
Trigger: 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.
Common situations: Manual ssh debugging sessions; exotic hg wrappers or CI tooling invoking hg directly; hg versions below the supported baseline.
Related errors
- Unknown Mercurial command "%s"!
- This repository ("%s") is not a Mercurial repository. Use "%
- This repository ("%s") is not available over SSH.
- Configuration file specifies cluster peer ("%s", at index "%
- This public key is already associated with another user or d
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/e0a29383bd497f61.
Report an issue: GitHub.