Skip to content

Conversation

@nilsding
Copy link
Member

As per the docs for NSFileProviderReplicatedExtension item(for:request:completionHandler:), the system will automatically retry calling the method if the error is not one of .notAuthenticated, .serverUnreachable, or .noSuchItem.

From my observations it seems that if the error .cannotSynchronize is returned for the root container (i.e.
NSFileProviderRootContainerItemIdentifier), the system/file provider framework just ends up deleting the newly created sync directory inside ~/Library/CloudStorage. This broke the entry in the Finder sidebar.

After changing the error to .notAuthenticated (which is semantically wrong, but alas), I now could disable/enable the File Provider as often as I wanted without the Finder sidebar entry to ever break due to the directory having been removed previously ... Strange, this.


I discovered this by comparing the logs when setting up the File Provider for the same account. The logs of such a failed invocation contained the following message, whereas successful ones did not:

% grep "Not fetching item because database is unavailable." fp-bob-failedinit.jsonl fp-bob-workinginit.jsonl 
fp-bob-failedinit.jsonl:{"category":"FileProviderExtension","date":"2025.10.15 16:09:37.902","details":{"item":"NSFileProviderRootContainerItemIdentifier"},"level":"error","message":"Not fetching item because database is unavailable."}

As per [the docs for `NSFileProviderReplicatedExtension
item(for:request:completionHandler:)`][1], the system will automatically
retry calling the method if the error is not one of `.notAuthenticated`,
`.serverUnreachable`, or `.noSuchItem`.

From my observations it seems that if the error `.cannotSynchronize` is
returned for the root container (i.e.
`NSFileProviderRootContainerItemIdentifier`), the system/file provider
framework just ends up deleting the newly created sync directory inside
`~/Library/CloudStorage`.  This broke the entry in the Finder sidebar.

After changing the error to `.notAuthenticated` (which is semantically
wrong, but alas), I now could disable/enable the File Provider as often
as I wanted without the Finder sidebar entry to ever break due to the
directory having been removed previously ...  Strange, this.

[1]: https://developer.apple.com/documentation/fileprovider/nsfileproviderreplicatedextension/item(for:request:completionhandler:)#Discussion

Signed-off-by: Jyrki Gadinger <[email protected]>
@nilsding
Copy link
Member Author

/backport to stable-4.0

@Rello Rello self-requested a review October 15, 2025 15:15
@nilsding nilsding enabled auto-merge October 15, 2025 15:26
@nilsding nilsding disabled auto-merge October 15, 2025 15:27
@nilsding nilsding enabled auto-merge October 15, 2025 15:32
@github-actions
Copy link

Artifact containing the AppImage: nextcloud-appimage-pr-8885.zip

Digest: sha256:855d7b441518b081df5f84891daa28f198eaa2f53d7f050859449373a5cadaa4

To test this change/fix you can download the above artifact file, unzip it, and run it.

Please make sure to quit your existing Nextcloud app and backup your data.

@nilsding nilsding disabled auto-merge October 15, 2025 15:45
@nilsding nilsding merged commit 979b6cf into master Oct 15, 2025
19 of 20 checks passed
@nilsding nilsding deleted the bugfix/noid/macos-init-disappearing-cloudstorage-directory branch October 15, 2025 15:45
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants