phacility/phabricator · error · Exception
Encountered Git protocol frame with unexpected frame length
Error message
Encountered Git protocol frame with unexpected frame length (%s)!
What it means
Protocol parser guard in willReadBytes: a pkt-line length prefix was decoded, but the resulting frame length is not a value the parser accepts (the length includes the 4 header bytes; 0 is a boundary frame handled separately). An implausible length means the stream is corrupt or truncated mid-frame.
Solutions
- Retry the transfer; transient truncation can cause this
- Check the network path/proxy for data corruption
- Verify the Git client and server speak the same protocol version
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php:58 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/d345906a92106eb8.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/diffusion/protocol/DiffusionGitUploadPackWireProtocol.php:58
$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
// are boundaries.
if ($frame_length === 0) {
$this->readFrames[] = $this->newProtocolFrame('null', '');
} else if ($frame_length >= 1 && $frame_length <= 3) {
throw new Exception(
pht(
'Encountered Git protocol frame with unexpected frame '.
'length (%s)!',
$frame_length));
} else {
$this->readFrameLength = $frame_length - 4;
$this->readMode = 'frame';
}
break;
case 'frame':
// We're expecting a protocol frame of a specified length. Note that
// it is possible for a frame to have length 0.
// We don't have enough bytes yet, so wait for more.
if ($len < $this->readFrameLength) {
break 2;
}View on GitHub (pinned to 5720a38cfe)