I’m still not sure how it arose, but I’ve managed to generate a seriously weird RTFD document. It behaves in many respects as you’d expect, but trying to copy it to iCloud threw either of two strange error alerts.
One is of an unexpected error – as if errors like this were ever expected – with a code of -8060, which eludes me. The other is even stranger:
suggesting that there’s a problem with the filename, which there manifestly isn’t.
My iCloud Drive hasn’t been the same since it was ravaged by Catalina beta, but it doesn’t normally throw wobblies like this. The document in question was being used to look at macOS versioning, and opening it using Revisionist didn’t reveal anything odd. What’s more, when I tried archiving its versions to a folder using that app or DeepArchive, everything worked fine until the current version, which was also behaving oddly.
In the Finder, I opened the RTFD package, and was surprised to see that it contained the expected files, one of RTF and three included images, and another RTFD package. Inside that was yet another RTFD package, and so on like Russian dolls.
The document had been created, with its previous versions, using TextEdit in macOS Mojave 10.14.6, and I suspect that’s where this strange problem occurred. It looked as if a circular hard link or quick copy had occurred, giving the package a recursive structure.
Repairing the file wasn’t at all difficult: simply opening the package and deleting the circular RTFD package did the trick. But if you try trashing the top-level document, macOS complains that the trapped RTFD document inside it can’t be deleted. Thankfully it can, so long as you do it separately and not within the top-level RTFD package.
So if you encounter such strange errors when working with an RTFD document, take a look inside. It might just be recursive.