Repository Commit task fails with Error building trees
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
The Repository Commit task fails and the logs show the following messages:
1
2
3
4
5
Error building trees
Error: invalid object
Error: object directory [...] does not exist
Environment
Bamboo with a Repository Commit task.
Diagnosis
The following error can be seen in the Bamboo logs:
1
2
3
4
5
10-Jun-2022 11:03:41 Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [...] failed with code 1. Working directory was [...]., stderr:
10-Jun-2022 11:03:41 error: object directory [...]/_git-repositories-cache/[...]/.git/objects does not exist; check .git/objects/info/alternates
10-Jun-2022 11:03:41 error: invalid object [...] for '.gitignore'
10-Jun-2022 11:03:41 error: invalid object [...] for '.gitignore'
10-Jun-2022 11:03:41 error: Error building trees
Cause
This is usually caused by repository cache corruption.
Solution
Clean up the caches on the Bamboo server by going to Cog icon > Overview > Repository settings > Manage caches and deleting the respective cache.
You can also try removing the repository from the build plan and then re-adding it.
Was this helpful?