phacility/phabricator · error · Exception

Unrecognized repository path "%s". Expected a path like "%s"

Error message

Unrecognized repository path "%s". Expected a path like "%s", "%s", or "%s".

What it means

The SSH path is interpreted by PhabricatorRepository::parseRepositoryServicePath, which only accepts the documented forms: /diffusion/<CALLSIGN>/, /diffusion/<id>/, or /<shortname>.git (like /source/thaumaturgy.git). Anything else returns null and loadRepositoryWithPath throws, listing the expected forms.

Source

Thrown at src/applications/diffusion/ssh/DiffusionSSHWorkflow.php:214

          'ssh',
        ),
      ));
    $this->shouldProxy = (bool)$uri;

    try {
      return $this->executeRepositoryOperations();
    } catch (Exception $ex) {
      $this->writeError(get_class($ex).': '.$ex->getMessage());
      return 1;
    }
  }

  protected function loadRepositoryWithPath($path, $vcs) {
    $viewer = $this->getSSHUser();

    $info = PhabricatorRepository::parseRepositoryServicePath($path, $vcs);
    if ($info === null) {
      throw new Exception(
        pht(
          'Unrecognized repository path "%s". Expected a path like "%s", '.
          '"%s", or "%s".',
          $path,
          '/diffusion/X/',
          '/diffusion/123/',
          '/source/thaumaturgy.git'));
    }

    $identifier = $info['identifier'];
    $base = $info['base'];

    $this->baseRequestPath = $base;

    $repository = id(new PhabricatorRepositoryQuery())
      ->setViewer($viewer)
      ->withIdentifiers(array($identifier))
      ->needURIs(true)

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Copy the exact clone URI from the repository's Diffusion main page (it includes the trailing slash)
  2. To use /source/<shortname>.git, give the repository a short name and enable that URI
  3. Prefer the numeric /diffusion/<id>/ form in automation because it survives callsign renames

Example fix

# before
git clone ssh://git@host/diffusion/X
# after
git clone ssh://git@host/diffusion/X/
Defensive patterns

Strategy: validation

Validate before calling

// Validate the clone path shape before connecting
if (!preg_match('@^/(diffusion/[A-Z]+|diffusion/[0-9]+|source/[^.]+\.git)/$@', $ssh_path)) {
  // fix the URL instead of hitting 'Unrecognized repository path'
}

Type guard

function isValidRepositoryServicePath($path) {
  return (bool)preg_match(
    '@^/(diffusion/[A-Z]+|diffusion/[0-9]+|source/[^.]+\.git)/$@',
    $path);
}

Prevention

When it happens

Trigger: Cloning with a malformed path: missing trailing slash (ssh://user@host/diffusion/X), unsupported roots (/repos/X.git), or using the /source/<shortname>.git form when the repository has no short name or shortname URIs are not enabled.

Common situations: Hand-typed clone URLs; scripts written against other hosting services; copying the path from the wrong URI field instead of the clone URI shown in the UI.

Related errors


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