I’ve documented it in rewrite: Document handling of "cannot encode tree" errors by MichaelEischer · Pull Request #5017 · restic/restic · GitHub . That doesn’t mean that this limitation has to stay around forever, but at least right now I don’t see an easy way to lift it.
The specification currently focuses on the most important aspects, although I have to agree that it could be a bit more detailed regarding the snapshot/tree format. However, I still doubt that it’s worth to document everything down to a level that guarantees perfectly identical results (that would require a level of detail that far exceeds that necessary to implement full read/write support of the repository format)
Neither reason can justify a failed backup run. Yes, it’s not ideal to not deduplicate some tree blobs in that case, but that’s still much better than not having a backup.
My perspective on the rewrite command is rather different. If a user runs rewrite to remove some file path, then they should be able to trust restic to not randomly lose metadata in the process.
backup should just use option 2 and let the normal deduplication handling take care of duplicates. The other options just introduce special cases.
For rewrite option 2 would result in data loss which isn’t acceptable IMO. Option 1 doesn’t work when anything in the snapshot has to be changed as this always results in a change of the root node. That node was the one that could not be encoded in the examples above. Thus only Option 3 remains.