phacility/phabricator · error · Exception

Bad frame length character in Git protocol ("%s"), expected

Error message

Bad frame length character in Git protocol ("%s"), expected a 4-digit hexadecimal value encoded as ASCII text.

What it means

Error "Bad frame length character in Git protocol ("%s"), expected a 4-digit hexadecimal value encoded as ASCII text." thrown in phacility/phabricator.

Source

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

    if ($this->readBuffer === null) {
      $this->readBuffer = new PhutilRope();
    }
    $buffer = $this->readBuffer;

    $buffer->append($bytes);

    while (true) {
      $len = $buffer->getByteLength();
      switch ($this->readMode) {
        case 'length':
          // We're expecting 4 bytes containing the length of the protocol
          // frame as hexadecimal in ASCII text, like "01ab". Wait until we
          // see at least 4 bytes on the wire.
          if ($len < 4) {
            if ($len > 0) {
              $bytes = $this->peekBytes($len);
              if (!preg_match('/^[0-9a-f]+\z/', $bytes)) {
                throw new Exception(
                  pht(
                    'Bad frame length character in Git protocol ("%s"), '.
                    'expected a 4-digit hexadecimal value encoded as ASCII '.
                    'text.',
                    $bytes));
              }
            }

            // We can't make any more progress until we get enough bytes, so
            // we're done with state processing.
            break 2;
          }

          $frame_length = $this->readBytes(4);
          $frame_length = hexdec($frame_length);

          // Note that the frame length includes the 4 header bytes, so we
          // usually expect a length of 5 or larger. Frames with length 0

View on GitHub (pinned to 5720a38cfe)

When it happens

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