phacility/phabricator · error · Exception

Define '%s' in your configuration to continue.

Error message

Define '%s' in your configuration to continue.

What it means

PhabricatorEnv::getAnyBaseURI() returns the canonical instance URI used to build absolute links from daemons, CLI tools, and mail. It first reads the `phabricator.base-uri` config; if empty it falls back to a request-scoped base URI; with neither set it throws, because generating correct absolute URIs is impossible. Most commonly hit from contexts that have no HTTP request (workers, mail rendering, bin scripts).

Source

Thrown at src/infrastructure/env/PhabricatorEnv.php:523

  /**
   * Build a concrete object from a configuration key.
   *
   * @task read
   */
  public static function newObjectFromConfig($key, $args = array()) {
    $class = self::getEnvConfig($key);
    return newv($class, $args);
  }

  public static function getAnyBaseURI() {
    $base_uri = self::getEnvConfig('phabricator.base-uri');

    if (!$base_uri) {
      $base_uri = self::getRequestBaseURI();
    }

    if (!$base_uri) {
      throw new Exception(
        pht(
          "Define '%s' in your configuration to continue.",
          'phabricator.base-uri'));
    }

    return $base_uri;
  }

  public static function getRequestBaseURI() {
    return self::$requestBaseURI;
  }

  public static function setRequestBaseURI($uri) {
    self::$requestBaseURI = $uri;
  }

  public static function isReadOnly() {
    if (self::$readOnly !== null) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Set the config: `./bin/config set phabricator.base-uri 'https://phab.example.com/'` (scheme + host + trailing slash, matching how users reach the install).
  2. If it is already set, check for a typo'd key or a config source that overrides it back to empty: `./bin/config get phabricator.base-uri` shows the effective value and its source.
  3. Restart daemons after fixing so long-running workers pick up the new config.

Example fix

# before: nothing set, daemon/mail generation fails
$ ./bin/mail render-test --to admin ...
Exception: Define 'phabricator.base-uri' in your configuration to continue.

# after
$ ./bin/config set phabricator.base-uri 'https://phab.example.com/'
$ ./bin/phd restart
Defensive patterns

Strategy: validation

Validate before calling

if (!PhabricatorEnv::getEnvConfig('phabricator.base-uri')) {
  die('Set phabricator.base-uri before running this script.\n');
}

Prevention

When it happens

Trigger: Running a daemon, worker task, or bin script (e.g. ./bin/mail render-test, or any code path calling PhabricatorEnv::getAnyBaseURI()) on an instance where `phabricator.base-uri` was never set and the fallback PhabricatorEnv::getRequestBaseURI() (set only during a web request) is null.

Common situations: Fresh installs that skipped the base-URI step and work fine in the browser (request fallback covers web) until the first mail or background task runs; multi-environment setups where local.json was cleared; Puppet/Chef provisioning that forgets this key.

Related errors


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