SVN reporting "Working copy text base is corrupt"

Posted by Dan on Jul 22, 2009 @ 11:24 AM

This morning started off to a rough start. I came in to realize the commit of a merge I made at the end of the day yesterday had failed. Whenever I would attempt to commit the merge changes, it would go through the entire process and then finally fail with a error message of:

org.tigris.subversion.javahl.ClientException: Working copy text base is corrupt

After trying a "Cleanup" and several other steps to rectify the problem, I finally did hit Google to try and find a solution. I came across chris' subversion checksum mismatch - easy workaround which offered several various solutions to the problem.

I tried several of the solutions, but wasn't haven't much success until I came across Michael Sparer's comment:

Thanks for the explanation, which shed some light on how svn manages its working copy. My problem seemed to stem from a bogus file under .svn/text-base, which didn't match the file actually on the server.
- server file (.../ OK
- orig copy from server (.svn/text-base/ BOGUS (not same as server)
- checksum (in .svn/entries): matches server, but not server copy

If I can make the bogus copy match what's on the server, then it will also match the checksum, and everyone will be happy.
What I did (i'll call the working dir with the corrupt file "orig-dir":
1. Fresh checkout of svn dir matching orig-dir into /tmp/blah
2. Copy /tmp/blah/.svn/text-base/ into orig-dir/.svn/text-base
3. Check in successfully

I wish svn would let you refresh a given file from the server...maybe there's a command and I just haven't found it or my svn is too old.

In the end, this ended up being my problem as well. The copy of me .svn/text-base/filename.ext.svn-base was out of sync with the actually copy on the server.

To resolve this, I checked out a clean copy from the server to a tmp folder, then I just replaced the copy in my working folder. After doing this, I was able to check in the file without incident.

I also noticed I had a copy of the template in the .svn/tmp/text-base/ folder. I made a copy of this file and then removed the file this directory before committing. I'm not sure if this step is necessary, but I wanted my local working copy to mirror as closely as possible a fresh working copy.
I could have just wiped my local copy altogether, but I wanted to know the root problem incase it every happens again. Since I have a pretty large repository it takes a while to checkout from SVN, so at least know I have an option to try if I ever run into the issue again that won't require me checking out the entire working directory structure.
Categories: HTML/ColdFusion, Java


  • It works
  • This worked for me. And due to the nature of the project I'd have had an awful lot of files to try to put right if it hadn't. So, many thanks!

    Looking back I realised I'd inadvertently done a search-and-replace on a folder which included the SVN folder. A proper schoolboy error. But at least it's sorted.
  • Looks like this is not working with subversion 1.7.8
  • @Kiran:

    I haven't run into the problem again. We've been on 1.7.x for a while now and things have been very stable.
  • The svn directory structure has changed since this blog was written. All the svn-base files are now stored under a .svn directory in the root of the checkout.

    Unfortunately, I wasn't able to easily figure out what svn-base files corresponded with the files that had a bad checksum. So, what I did was to make a new checkout and then copy all of the files that had changed from the corrupted checkout to the new one. Then I was able to successfully commit the updated files.

    There is probably a better way but this worked for me.

Comments for this entry have been disabled.