Git Clone Fails with inflate: data stream error (incorrect header check)
Deepak Kumar Mishra, Support Engineer, EMEA TFS Team, brings this knowledge experience while working with one of his customers.. Read on
Recently I was working on an issue where the Git clone operation failed in a customer environment and while troubleshooting the Git Push operation also failed for a few users blocking Tfs operations Completely.
Error:
Git Clone Fails with inflate: data stream error (incorrect header check)
I checked in the event logs and found the following error:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 10.02.2015 09:31:36
Machine: TFS01
Application Domain: /LM/W3SVC/2/ROOT/tfs-1-130680223897599771
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v4.0.30319
Service Host: b94ad55e-7e02-4335-a6d1-1c740d6fjeyud49 (Collection)
Process Details:
Process Name: w3wp
Process Id: 400
Thread Id: 56
Account name:
Detailed Message: TF30065: An unhandled exception occurred.
Web Request Details
Url: [method: POST]
User Agent: git/1.0 (Microsoft libgit2 Client 12.0.0.0)
Headers: Transfer-Encoding=chunked&Content-Type=application%2fx-git-receive-pack-request&Accept-Encoding=gzip&Expect=100-continue&Host=tfs01%3a8080&User-Agent=git%2f1.0+(Microsoft+libgit2+Client+12.0.0.0)
Path: /tfs/siemenscollection/_git/TiaSelectionTool/git-receive-pack
Local Request: False
Host Address: 192.16.1.1
User: domain/xxxx [authentication type: NTLM]
Exception Message: TF14103: Internal error: The database procedure prc_WriteGitRefs returned the wrong number of rows. (type UnexpectedDatabaseResultException)
Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.ResultCollection.NextResult()
at Microsoft.TeamFoundation.Git.Server.GitCoreComponent17.WriteRefs(String teamProjectUri, Guid repositoryId, Guid pusherId, IEnumerable`1 requests, IEnumerable`1 commitIdsInRefs, IEnumerable`1 commitParents, DateTime& pushTime, Int32& pushId)
at Microsoft.TeamFoundation.Git.Server.TfsGitRepositoryRefsCollection.Write(TeamFoundationRequestContext requestContext, IEnumerable`1 requests, Dictionary`2 commitIdsInRefs, DateTime& pushTime, Int32& pushId)
at Microsoft.TeamFoundation.Git.Server.TfsGitRepository.ApplyRefUpdates(TeamFoundationRequestContext requestContext, IGitPushReporter pushReporter, List`1 refUpdateRequests, Dictionary`2 includedCommitIds, List`1 allResults, DateTime& pushTime, Int32& pushId, IEnumerable`1& results)
ISSUE:
It’s a corrupted packfile on the server (could have occurred in any number of ways, including hardware/network/etc issues)
After an extensive research I found the following solution. I would like to propose this solution to the above mentioned problem. Hope it helps.
SOLUTION:
In such situations the below mentioned workaround will help to fix the issue without causing any information loss(version history and links). However, before that we need to check the following things
Pre-requisites: Please create a new repo on the server and push the most recent copy of code from client repository to the newly created server repository. However, before doing that, please run 'git-fsck--verbose' command at client repository to make sure the integrity of the data in local repository(client) is maintained and we can identify if there are any corruptions in data. Also make sure cloning works from this new repository location after pushing the code.
If the above pre-requisites are satisfied, the following steps will get the user unblocked :
- Go to “Version control” project management tab by clicking on settings icon in the git team project web portal as shown below:
or directly browse to URL: tfs:8080/tfs/Collectionname/Teamprojectname/_admin/_versioncontrol
- Rename the old “Test-git” repository to “Test-git_Broken”
- Create a new repository called “Test-git”
- Mirror the bare clone to the local (bare) test git repository by running the following command from the folder which has the latest clone as mentioned in pre-requisites:
git push --mirror https://xxxx.tfs.com/DefaultCollection/_git/test-git
- After performing some tests, you can delete the “Test-git_Broken” repository.
In this way we would be able to preserve all the changes and links existing in the current repository and get back with normal Tfs operations.
Written by Deepak Kumar Mishra, Support Engineer
Reviewed by Nitish Nagpal, Support Escalation Engineer
Comments
- Anonymous
April 07, 2017
hello, I have met the problem as the same as your have mentioned. for now,I just figure it out the ways to resolve this problem for a while,but I don’t think it’s the best choice until I see your article.here is my resolution:1、change a new server for the developer2、free the cache when you need to clone (it do work,but it is so noisy for the problem happens offen )when I read your article, I have no doubt that it may could resolve this issue entirely.but i don’t understand one step : run the command “git-fsck–verbose” at client repository ? first, we have no repository when we git clone failed; second, i can’t find any command on server like “git-fsck–verbose” ,do i misunderstand your meaning?(by the way,my server system is Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)hope for you reply ASAP,thanks