Recently I had an SVN repository with a couple of corrupt revisions that I couldn’t figure out how to fix, which caused Trac to stop displaying revisions after the corruption.

Trying trac-admin resync was no help, throwing this exception :

$ sudo trac-admin /path/to/your/repository/ resync
Resyncing repository history...
Traceback (most recent call last):
  File "/usr/bin/trac-admin", line 7, in ?
  File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/admin/", line 1249, in run
    return admin.onecmd(command)
  File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/admin/", line 104, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib64/python2.4/", line 219, in onecmd
    return func(arg)
  File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/admin/", line 632, in do_resync
    repos = env.get_repository().sync(self._resync_feedback)
  File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/versioncontrol/", line 195, in sync
    for path,kind,action,bpath,brev in cset.get_changes():
  File "/usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/versioncontrol/", line 882, in get_changes
    repos.svn_repos_replay(root, e_ptr, e_baton, pool())
  File "/usr/lib64/python2.4/site-packages/libsvn/", line 245, in svn_repos_replay
    return apply(_repos.svn_repos_replay, args)
libsvn._core.SubversionException: ("Filesystem path 'trunk/path/to/corrupt/file' is neither a file nor a directory", 160013)

I wasted several days trying to export svn and re-create the repository etc, but continued to get the same corrupt revision.

To get around this error (note this doesn’t fix the corrupt revision - it just allows you to continue using Trac to see later revisions), edit the ‘’ file listed in the trac-admin stack trace:

$ sudo vi /usr/lib/python2.4/site-packages/Trac-0.11-py2.4.egg/trac/versioncontrol/

Go to the line mentioned in the stacktrace (line 882 in my case) :

repos.svn_repos_replay(root, e_ptr, e_baton, pool())

and put a try/catch around it :

   repos.svn_repos_replay(root, e_ptr, e_baton, pool())
   print "Warning : Revision " + str(self.rev) + " could not be read."

Now when you run trac-admin resync , it should display a warning for the corrupted revisions, but continue to sync the repository instead of crashing:

$ sudo trac-admin /path/to/your/repository/ resync
    Resyncing repository history...
    Warning : Revision 297 could not be read.
    Warning : Revision 678 could not be read.
    Warning : Revision 906 could not be read.
    1101 revisions cached. Done.