SQL error when debugging android app

For the last couple of weeks I’ve been having this issue that when I run react-native run-android with my device connected Joplin will fail with this error:

Looks like it occurs when Joplin runs the database upgrade sequence, between versions 4 and 5.

It does not happen every time and the only way to get rid of this it seems is to stop everything, clear Joplin data on device or uninstall the app completely and then try again.

Has anyone else seen this? This is seriously annoying and almost makes me want to give up.

The only way it could happen is if the “version” value does not correspond to the current database schema, but that’s normally impossible because the version is updated within the same transaction as the schema update (in upgradeDatabase).

Could it be due to React Native “Fast Refresh”? It’s completely broken yet they enable by default, and I’ve seen strange behaviours due to it. I’ve tried to disable it in main.js but it’s done in an undocumented way so maybe it’s still active.

When it happens, is it when you manually reload? What is you force close the app and restart it?

Thanks Laurent
Yes it occurrs on fast refresh. The strangest thing is that this feature was working for a while and I started to appreciate it.