phacility/phabricator · error · Exception

Unknown Mercurial key namespace

Error message

Unknown Mercurial key namespace '%s', with key '%s' (%s -> %s). Rejecting push.

What it means

Protocol guard in findMercurialPushKeyRefUpdates: Mercurial invoked the push-key hook with an HG_KEY namespace other than 'bookmarks' (the only namespace this hook understands). Because the change cannot be interpreted safely, the push is rejected rather than silently ignored.

Solutions

  1. Avoid pushing non-bookmark key namespaces (e.g. phases or extras) that the server does not handle
  2. Upgrade/align the Mercurial client and server versions so namespaces match expectations
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:985 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/95217f73d12a1c1b. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:985

      // just ignore these, as they don't seem to represent anything
      // interesting.
      return array();
    }

    $key_name = getenv('HG_KEY');

    $key_old = getenv('HG_OLD');
    if (!strlen($key_old)) {
      $key_old = null;
    }

    $key_new = getenv('HG_NEW');
    if (!strlen($key_new)) {
      $key_new = null;
    }

    if ($key_namespace !== 'bookmarks') {
      throw new Exception(
        pht(
          "Unknown Mercurial key namespace '%s', with key '%s' (%s -> %s). ".
          "Rejecting push.",
          $key_namespace,
          $key_name,
          coalesce($key_old, pht('null')),
          coalesce($key_new, pht('null'))));
    }

    if ($key_old === $key_new) {
      // We get a callback when the bookmark doesn't change. Just ignore this,
      // as it's a no-op.
      return array();
    }

    $ref_flags = 0;
    $merge_base = null;
    if ($key_old === null) {

View on GitHub (pinned to 5720a38cfe)