phacility/phabricator · error · Exception

Object ("%s") claims "%s" is a GitHub repository URI, but th

Error message

Object ("%s") claims "%s" is a GitHub repository URI, but the path ("%s") does not have enough components (expected at least two).

What it means

The URI from getCircleCIGitHubRepositoryURI() passed the github.com domain check, but after trimming slashes its path splits into fewer than two components. The CircleCI v1 API endpoint this step builds (circleci.com/api/v1/project/{namespace}/{name}) needs an owner and a repository name, so a path like "/" or "/owner" cannot be used. The check is count($path_parts) < 2 after trim($path, '/') and explode('/').

Source

Thrown at src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php:122

    $github_uri = $object->getCircleCIGitHubRepositoryURI();
    $build_type = $object->getCircleCIBuildIdentifierType();
    $build_identifier = $object->getCircleCIBuildIdentifier();

    $path = self::getGitHubPath($github_uri);
    if ($path === null) {
      throw new Exception(
        pht(
          'Object ("%s") claims "%s" is a GitHub repository URI, but the '.
          'domain does not appear to be GitHub.',
          $object_phid,
          $github_uri));
    }

    $path_parts = trim($path, '/');
    $path_parts = explode('/', $path_parts);
    if (count($path_parts) < 2) {
      throw new Exception(
        pht(
          'Object ("%s") claims "%s" is a GitHub repository URI, but the '.
          'path ("%s") does not have enough components (expected at least '.
          'two).',
          $object_phid,
          $github_uri,
          $path));
    }

    list($github_namespace, $github_name) = $path_parts;
    $github_name = preg_replace('(\\.git$)', '', $github_name);

    $credential_phid = $this->getSetting('token');
    $api_token = id(new PassphraseCredentialQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($credential_phid))
      ->needSecrets(true)
      ->executeOne();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Correct the URI so its path contains owner/repository, e.g. 'https://github.com/acme/app.git'.
  2. If the URI comes from your own implementation of HarbormasterCircleCIBuildableInterface, return the full repository URI including the repository name.
  3. Verify the Diffusion repository's staging URI / GitHub remote includes the repository directory, not just the namespace.

Example fix

// before
$github_uri = 'https://github.com/acme';

// after
$github_uri = 'https://github.com/acme/app.git';
Defensive patterns

Strategy: validation

Validate before calling

$path = trim(HarbormasterCircleCIBuildStepImplementation::getGitHubPath($uri), '/');
if (count(explode('/', $path)) < 2) {
  // URI lacks owner/repository - fix before running the step
}

Type guard

function isGitHubRepoPathComplete($uri) {
  $path = HarbormasterCircleCIBuildStepImplementation::getGitHubPath($uri);
  if ($path === null) {
    return false;
  }
  return count(explode('/', trim($path, '/'))) >= 2;
}

Prevention

When it happens

Trigger: getCircleCIGitHubRepositoryURI() returns something like 'https://github.com' (empty path), 'https://github.com/acme' (only an owner), or a URI whose path was stripped/mangled by the implementing class. The domain check passes, then the component count fails at HarbormasterCircleCIBuildStepImplementation.php:121.

Common situations: Staging or remote URI configured to a GitHub user/organization profile page instead of a repository; custom interface implementation that builds the URI from parts and drops the repo name; trailing-slash-only URIs such as 'https://github.com/'.

Related errors


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