Wound up with two iCloud Drive “Bike” folders

I’m not quite sure how this happened. And I’ll preface the report by saying that while I think most people would have suffered serious data loss (files just disappeared), and I almost did, I got lucky and was able to rescue all my missing Bike files from a second Mac that, luckily hadn’t finished an iCloud sync that I think would have lost the files there too.

Basically, I somehow wound up with two “Bike” folders in my iCloud Drive. Most of my Bike documents were in one that was somehow hidden in the Finder. After a restart, which I thought might rectify the syncing confusion on iCloud’s part, that folder was simply gone. To be clear, I suspect this was an iCloud bug/glitch, not Bike’s, but it was Bike’s files I nearly lost.

I first noticed something was wrong when I started getting alert sheets in Bike for my open documents, telling me they were missing or something, and that I had the option of either keeping them or closing them, and that if I closed them I’d lose them. I wish to hell I’d taken a screenshot of this but I didn’t. Sorry. I of course clicked the “Keep” button for each of them.

I foolishly chalked this up to a one-time iCloud glitch. But it happened again. That’s when I restarted the Mac (running MacOS 15.2) and when it finished restarting and I logged back in, those files were gone, and they weren’t listed in Bike’s File → Open Recent menu. Not in the Trash, not in Recently Deleted when I looked at iCloud.com. Just gone.

I’m lucky to have more than one Mac. On this second Mac, I took great care. It turns out I have two Bike folders in iCloud drive. Only one of them is visible in the Finder, and that one also shows the magic Bike icon on the folder icon. Alas, that folder only has some of my Bike files.

However, when I launched Bike on this second Mac, all my other files (which I’d left open in Bike) were reopened. I used the Cmd-click trick on the document proxy icon to open the folder containing the file. At first I was confused, because this opened a second Bike folder window in the Finder. Both of them looked, in the Finder, like they were at iCloud Drive > Bike. But the two folders held entirely different Bike files. And the one with my more important, currently open files was the one that didn’t have the magic Bike icon on the folder icon.

Dropping into Terminal revealed the descrepancy. The working folder, with the magic icon, visible in the Finder, had the path:

/Users/gruber/Library/Mobile Documents/iCloud~com~hogbaysoftware~Bike/Documents

The other Bike folder, the one that I couldn’t see at the root level of iCloud Drive in the Finder, which didn’t have the badged folder icon, but which contained most of my Bike files, had the path:

/Users/gruber/Library/Mobile Documents/iCloud~hogbaysoftware~Bike/Documents

There’s a missing ~com in the one that contained my missing files and which disappeared out from under me.

My best guess what happened here is that way back in very earliest days of Bike, I think I created a “Bike” folder at the root level of iCloud Drive, and by habit saved all my Bike documents there. But, trying to research this situation here in this forum’s history, I see in the notes for Bike 1.18.1 (173): "Added Bike specific iCloud drive folder”.

That was back in February though, so if this caused a conflict with my own hand-created “Bike” folder at the root of iCloud Drive, I don’t understand why I only ran into a conflict yesterday.

Also, my conflicted folder had a bunch of duplicates of my files, with numbers appended to their names. The sort of numbering you get when iCloud Drive sync runs into a conflict between files updated on different machines.

I’m all good, I think, in terms of now having found the missing files and copied them to safe place outside iCloud Drive. I think I only lost a few lines of text in one file. Disaster averted. But I’m damn curious what happened!

1 Like

Ugh, glad nothing was lost.

I suspect this was due, at least in part, to a configuration mess-up between 18.1 (18 Mar 2024) and 18.2 (30 Apr 2024). I think those are the only release where iCould configuration has changed.

Do you know if this started happened due to a Bike update? Maybe one of the computers was on Bike 1.18 and was recently updated?

Generally what I know is:

  • In Bike 1.18 and before there was no special iCloud Document integration. Bike worked fine with iCloud, but had no declared NSUbiquitousContainers.

  • In Bike 1.18.1 (18 Mar 2024) I tried to get that special Bike specific iCloud folder by adding special iCloud entitlement and by creating a dedicated NSUbiquitousContainer for Bike I think that info is encoded in 1.18.1 as:

<key>NSUbiquitousContainers</key>
<dict>
	<key>iCloud.hogbaysoftware.Bike</key>
	<dict>
		<key>NSUbiquitousContainerIsDocumentScopePublic</key>
		<true/>
		<key>NSUbiquitousContainerName</key>
		<string>BikeOutliner</string>
		<key>NSUbiquitousContainerSupportedFolderLevels</key>
		<string>ANY</string>
	</dict>
</dict>

Alas something wasn’t quite right, and made this comment for 18.2 preview release, unfortunately I don’t remember what I meant when I said “half way for one iCloud location ID, and half up for another ID”. I think maybe it was somehow setup so that the iCloud server container was using one id, while the local Xcode config was using a different one… but looking at Xcode UI I’m not sure how that would have been possible.

Generally I was worried about touching iCloud and I think tried to have Xcode make all the choices for me, but somehow I messed something up in 18.1 and the fix for 18.2 was to change configuration to:

<key>NSUbiquitousContainers</key>
<dict>
	<key>iCloud.com.hogbaysoftware.Bike</key>
	<dict>
		<key>NSUbiquitousContainerIsDocumentScopePublic</key>
		<true/>
		<key>NSUbiquitousContainerName</key>
		<string>Bike</string>
		<key>NSUbiquitousContainerSupportedFolderLevels</key>
		<string>ANY</string>
	</dict>
</dict>

That was released in 30 Apr 2024 and I don’t think I’ve touched any iCloud related setting since. Bike does currently have two NSUbiquitousContainers on the server, iCloud.com.hogbaysoftware.Bike and the older iCloud.hogbaysoftware.Bike. I figured safest to just leave the old one active.

I can understand how the two different folders appeared due to configuration issues between 1.18.1 and 1.18.2, but I don’t understand why documents would started getting deleted from one. Looking on my computer I still see the old iCloud~hogbaysoftware~Bike/Documents folder. It’s no longer accessible through Bikes UI, but if I explicitly save files to it they seem to work, and they are not deleted on restart. I’m on 15.1. I guess I’ll update now and see if that changes the behavior.

Jesse

1 Like

On 15.2 the old iCloud~hogbaysoftware~Bike/Documents is still there for me, document saved to it persist, and sync between computers. Like on 15.1 it doesn’t show up in sidebar as Bike’s default iCloud folder, but generally it still seems to work as a persistent iCloud location.

1 Like

I don’t think it would be the result of a Bike update. I only really use Bike right now on two devices, my personal M1 MacBook Pro and a second temporary MacBook Pro (an M4 review unit from Apple). The M4 MBP was set up as a clone of my personal one via Migration Assistant in early November, and Bike was up to date then.

One factor could be that my M1 MBP is still on MacOS 15.1.1 but I upgraded the M4 MBP to MacOS 15.2. The problems started to occur around that time, but I can’t how closely it corresponds.

On 15.2 the old iCloud~hogbaysoftware~Bike/Documents is still there for me, document saved to it persist, and sync between computers.

And then this morning they were gone…

And then I added the old ubiquity container ID back to my local Bike build and those gone files came back.

The good news is that I think this means these file aren’t actually being deleted, they are just being removed from local computer, but kept in iCloud. The bad news is I really have no idea what I’m doing with these settings, or what the proper resolution is.

Will do more reading.

Here’s a test for anyone following along:

Run the attached app and (@gruber see if you files come back) and anyone else see if you have any files stored in Bike’s old ubiquity container. If you do you should move them to Bike’s new ubiquity container.

Assuming you are running latest version of Bike the new container should be found by going to Finder sidebar. Click iCloud Drive. And then open the “Bike” folder.


What the attached app does is associates with Bike’s old ubiquity container. And the reveals that container on startup… besides that it’s just a default template app that doesn’t do anything.

OldBikeDocuments.zip (62.8 KB)

(Worth noting to others: the OldBikeDocuments app requires MacOS 15.2 — the error message on older OS versions just say it can’t open.)

I ran it, and it indeed opened my old Bike ubiquity container, but that container was empty, because I’d already gone through and restored all my .bike documents to my new Bike ubiquity container.

@jessegrosjean So what should I do now? Should I just leave my now-empty old Bike ubiquity container and ignore it, in perpetuity? Or should I delete it? I don’t even know how to delete one of these containers.

I’m just ignoring it.

I see posts saying they are impossible to delete locally (ie the iCloud\~hogbaysoftware\~Bike folder in Mobile Documents. And that seems to be my experience.

Then I see some posts that say in many cases you can if you follow the right sequence of steps… I haven’t tried that.

I’ve have tried deleting the folder iCloud\~hogbaysoftware\~Bike from Mobile Documents without success. If it’s visible in iCloud Drive then when I drag to trash I get a warning that this is deleting my documents from iCloud and off all my devices… but after doing that I still have iCloud\~hogbaysoftware\~Bike on the filesystem, just not visible as a folder in iCloud Drive.