phacility/phabricator · error · Exception

Unexpected "git upload-pack" protocol frame: expected

Error message

Unexpected "git upload-pack" protocol frame: expected "<hash> <name>\n", or "shallow <hash>\n", got "%s".

What it means

Parser guard in newProtocolRefMessage for NON-first frames: a subsequent ref advertisement line fails to match '<hash> <name>\n' or 'shallow <hash>\n'. Unlike the first frame, no capabilities are expected here, so any other content in the stream is treated as a protocol violation.

Solutions

  1. Verify the Git protocol versions on both ends agree
  2. Check for stream corruption introduced by proxies or transports
  3. Capture the raw advertisement to identify the malformed line
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php:234 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/d9723abb62fa2412. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php:234

            '|'.
            'shallow (?P<shallow>[0-9a-f]{40})'.
          ')'.
          '\n'.
          '\z'.
        ')',
        $bytes,
        $matches);

      if (!$ok) {
        if ($is_first) {
          throw new Exception(
            pht(
              'Unexpected "git upload-pack" initial protocol frame: expected '.
              '"<hash> <name>\0<capabilities>\n", or '.
              '"shallow <hash>\n", got "%s".',
              $bytes));
        } else {
          throw new Exception(
            pht(
              'Unexpected "git upload-pack" protocol frame: expected '.
              '"<hash> <name>\n", or "shallow <hash>\n", got "%s".',
              $bytes));
        }
      }

      if (isset($matches['shallow'])) {
        $name = null;
        $hash = $matches['shallow'];
        $is_shallow = true;
      } else {
        $name = $matches['name'];
        $hash = $matches['hash'];
        $is_shallow = false;
      }

      if (isset($matches['capabilities'])) {

View on GitHub (pinned to 5720a38cfe)