Git protocol-error-bad-pack-header The stream fetched from the server did not start with a valid packfile header.
Reviewed for reference consistency: August 11, 2026
Code is Safe
SECUREGit has paused the operation to protect your code. No data has been lost or corrupted.
What To Know
Where Did It Fail?
Commands That Trigger This
Technical Background
A pack header is three small, strictly defined fields. Failing that early means the damage is at the very start of the stream — before any object data — so the problem is structural (wrong bytes, truncated start, rewritten stream) rather than a checksum mismatch deep inside a large pack.
The same client distinguishes this from its sibling message: 'invalid index-pack output' means the unpacker's reporting broke down, while 'bad pack header' means the header itself was judged invalid. Both point back at the transfer path or the server, not at the local repository.
Underlying Causes
Frequently Asked Questions
When the cause is transient network corruption, a retry with a fresh stream succeeds; when the server's stored packs are damaged, every attempt fails identically until the server repairs them.
The packfile format is part of Git's transfer protocol; a header that cannot be parsed is a protocol-level violation, reported before any object is processed.
Related Git States
Git detected corruption inside one of its compressed data bundles (packfiles).
The connection to the server was closed abruptly before Git finished transferring data.
Git received an End-Of-File signal before it finished downloading the expected repository data.
The helper unpacking a fetched pack produced output the fetcher could not interpret.