Bamboo remote agent can't execute GIT repo operations with error: RPC failed; result=22, HTTP code = 422
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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 build is failing when using a remote agent with the error : "error: RPC failed; result=22, HTTP code = 422", check the below stack trace from <bamboo-agent-home>atlassian-bamboo.log file.
Caused by: com.atlassian.bamboo.repository.RepositoryException: Cannot fetch branch 'refs/heads/master' from '<repo-URL>' to source directory '<Bamboo-agent-home>/xml-data/build-dir/_git-repositories-cache/c164771460882b932d7f304d1811d5673bfc8ee0'. command [/usr/bin/git -c 'credential.helper=store --file=/tmp/gitCredentials5755204464707531159.tmp' fetch <repo-URL> +refs/heads/master:refs/heads/master --update-head-ok] failed with code 128. Working directory was [<Bamboo-agent-home>/xml-data/build-dir/_git-repositories-cache/c164771460882b932d7f304d1811d5673bfc8ee0]., stderr:
error: RPC failed; result=22, HTTP code = 422
fatal: The remote end hung up unexpectedly
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.fetch(NativeGitOperationHelper.java:555)
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.fetch(NativeGitOperationHelper.java:524)
at com.atlassian.bamboo.plugins.git.v2.AbstractGitExecutor.fetchCacheWithRetry(AbstractGitExecutor.java:238)
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.lambda$checkout$1(GitWorkingCopyManager.java:237)
at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)
at com.atlassian.bamboo.plugins.git.GitCacheDirectory$LoggingManagedLock.withLock(GitCacheDirectory.java:44)
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.checkout(GitWorkingCopyManager.java:235)
at com.atlassian.bamboo.plugins.git.v2.GitWorkingCopyManager.retrieveSourceCode(GitWorkingCopyManager.java:122)
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.fillWorkingDirFromVcs(VcsCheckoutTask.java:206)
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask.access$000(VcsCheckoutTask.java:54)
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$1.call(VcsCheckoutTask.java:126)
at com.atlassian.bamboo.plugins.vcs.task.VcsCheckoutTask$1.call(VcsCheckoutTask.java:123)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:112)
... 20 more
Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command [/usr/bin/git -c 'credential.helper=store --file=/tmp/gitCredentials5755204464707531159.tmp' fetch <repo-URL> +refs/heads/master:refs/heads/master --update-head-ok] failed with code 128. Working directory was [<Bamboo-agent-home>/xml-data/build-dir/_git-repositories-cache/c164771460882b932d7f304d1811d5673bfc8ee0]., stderr:
Environment
Bamboo 8.0.9 with remote agent and GIT 1.8 but the solution listed below will be applicable for all supported Bamboo version
Diagnosis
Build execution is successful on the local agent
The repository is accessible and you are able to clone the repository manually on the remote agent
Compared the git version between the local agent and remote agent
Cause
Git version 1.8 is used on the remote agent
Solution
Upgrade git to a supported version on the remote agent, refer supported platform for more details regarding right version to use.