Git protocol-error-bad-pack-header The stream fetched from the server did not start with a valid packfile header.

dev@local: ~/project — git
dev@local~/project$git status
error: protocol error bad pack header
Diagnostics Translation
The stream fetched from the server did not start with a valid packfile header.
waiting for resolution...
MediumVersion Control System

Reviewed for reference consistency: August 11, 2026

Code is Safe

SECURE

Git has paused the operation to protect your code. No data has been lost or corrupted.

What To Know

The start of the incoming stream was not a valid packfile — the header check failed early, which implicates the server's packs or the network path between you and them.

Where Did It Fail?

Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
Git halted to protect the uncommitted files in your active working directory.

Commands That Trigger This

Cloning from a self-hosted server whose packfiles were damaged by a disk fault
Fetching through a TLS-intercepting appliance that mangles the byte stream
A clone interrupted by server memory pressure, leaving a truncated header

Technical Background

01

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.

02

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

Corrupted pack data on the server, for example from a failed disk or an interrupted repack
A proxy or security appliance altering bytes inside the transfer
A truncated response where the header never completed
Bit flips or encoding transforms applied to the binary stream in transit

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