     private var realmNotificationTokens: [NotificationToken] = []
 
     private func observeLocalChanges() {
+        guard !storage.realm.isInWriteTransaction else {
+            os_log("Realm is in a write transaction, waiting before registering observers", log: self.log, type: .debug)
+            DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+                self.observeLocalChanges()
+            }
+            return
+        }
+        
         registerRealmObserver(for: Favorite.self)
         registerRealmObserver(for: Bookmark.self)
         registerRealmObserver(for: SessionProgress.self)

                       type: .error,
                       String(describing: error))

                error.retryCloudKitOperationIfPossible(self.log) { self.fetchChanges() }
            } else {
                self.privateChangeToken = token
            }

        }
        set {
            guard let newValue = newValue else {
                defaults.removeObject(forKey: #function)
                return
            }

