There's two aspects on this issue: one aspect is the problem of the cache manager trying to load a document which is reported by XWIKI-22955. But there's also a more generic aspect, which is that the migration relies on NotificationFilterPreferenceStore and more generally tries to perform immediately an insert request on a subwiki before it's been migrated. If in the future we update the schema of NotificationFilterPreference table then this migration wouldn't work at all anymore I think since it would prevent performing the insertion.