Repository Commit task fails with Error building trees

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

Summary

The Repository Commit task fails and the logs show the following messages:

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:

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.

Last modified on Jun 29, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.