phacility/phabricator · error · Exception

Unable to identify the protocol for URI

Error message

Unable to identify the protocol for URI "%s". URIs must be fully qualified and have an identifiable protocol.

What it means

Raised in HarbormasterURIArtifact::validateURI when PhutilURI cannot extract a protocol from the artifact's 'uri' property, meaning the URI is not fully qualified (e.g. missing scheme). Artifact creation and link rendering reject it.

Solutions

  1. Store an absolute URI with an explicit scheme (e.g. https://...)
  2. Fix the build plan step that produces the artifact URI
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/harbormaster/artifact/HarbormasterURIArtifact.php:100 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/applications/harbormaster/artifact/HarbormasterURIArtifact.php:100

        'href' => $uri,
        'target' => '_blank',
        'rel' => 'noreferrer',
      ),
      $name);
  }

  public function willCreateArtifact(PhabricatorUser $actor) {
    $artifact = $this->getBuildArtifact();
    $uri = $artifact->getProperty('uri');
    $this->validateURI($uri);
  }

  private function validateURI($raw_uri) {
    $uri = new PhutilURI($raw_uri);

    $protocol = $uri->getProtocol();
    if (!strlen($protocol)) {
      throw new Exception(
        pht(
          'Unable to identify the protocol for URI "%s". URIs must be '.
          'fully qualified and have an identifiable protocol.',
          $raw_uri));
    }

    $protocol_key = 'uri.allowed-protocols';
    $protocols = PhabricatorEnv::getEnvConfig($protocol_key);
    if (empty($protocols[$protocol])) {
      throw new Exception(
        pht(
          'URI "%s" does not have an allowable protocol. Configure '.
          'protocols in `%s`. Allowed protocols are: %s.',
          $raw_uri,
          $protocol_key,
          implode(', ', array_keys($protocols))));
    }
  }

View on GitHub (pinned to 5720a38cfe)