Build fails due to bad pack header error

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Bamboo build fails with bad pack header in the logs.

Environment

All Bamboo versions.

Diagnosis

The following error appears in the <bamboo-home>/logs/atlassian-bamboo.log:

Warning: Permanently added '[127.0.0.1]:32495' (RSA) to the list of known hosts. Connection to 127.0.0.1 closed by remote host. fatal: the remote end hung up unexpectedly fatal: protocol error: bad pack header

Cause

This issue often indicates memory problems on the server.

Solution

  1. Login to the Bamboo server as the Bamboo user used to start the service and run the commands below:

    git config --global pack.windowMemory "100m" git config --global pack.packSizeLimit "100m" git config --global pack.threads "1" git config --global pack.deltaCacheSize "512m"

    ℹ️ The memory values above may change according to each server. The values above are just a recommendation, but if the problem persists, feel free to adjust those memory values according to your server settings.

  2. Go to Overview > Repository Settings and manually clean the caches for all Git repositories

Some details on Git configuration

Git configuration

Description

pack.windowMemory

The maximum size of memory that is consumed by each thread.

pack.packSizeLimit

The maximum size of a pack.

pack.threads

Specifies the number of threads to spawn when searching for the best delta matches.

pack.deltaCacheSize

The maximum memory used for caching deltas before writing them out to a pack.

Updated on May 22, 2025

Still need help?

The Atlassian Community is here for you.