Snapshot rewrite failure

Here’s one I haven’t seen yet. So I wrote a huge excludes file for both Windows and Mac, to streamline the sheer amount of stuff I back up for my users. I made a duplicate repo, which is about 8TB. I rewrote the whole thing, applying the exclude file with the following command:

restic rewrite --forget --exclude-file exclude.txt

It rewrote everything but one snapshot, which gives this error:

Fatal: unable to rewrite snapshot ID “66cdbf88”: cannot encode tree at “/path/to/random/file/being/excluded” without loosing [sic] information.

Now to me this suggests it isn’t necessarily corruption. What’s this mean, exactly? Can some snapshots, just by their nature, not be rewritten? That’s kind of what I’m picking up from this error message, but I thought I’d ask for confirmation. Thanks!

The error is a sanity check to ensure that rewriting a snapshot does not accidentally modify the content of a directory due to encoding problems. My guess would be that there’s a symlink somewhere which is not valid utf-8. Another possible cause might be corrupted data in the tree blob.

Ahh. Well it was a bunch of ~/Library folders I excluded, where Apple makes heavy use of symlinks. Restic check says everything is okay - would I need to run --read-data to know for sure?

check without --read-data is enough to verify the metadata in a snapshot. As rewrite only works on metadata, a simple check run is enough.

@akrabu Btw, thanks for finding the typo :slight_smile: (Tweak debug logs by MichaelEischer · Pull Request #4302 · restic/restic · GitHub)

1 Like

it did make it easy to find the exact line in the code :smiley:

1 Like