Anyway you could move the version.txt file to either another directory or rename it? Also, if your Nextcloud instance has everything on it and it’s correct, I’d fully download your sync directory from there to your desktop so you have a backup of that just in case you accidentally delete it when trying to fix this issue.
If you’re not on Joplin 1.0.199 yet, make a Jex export backup (broken in latest release) and move your ~/.config/joplin-desktop to another location (to back up settings in case). If you have upgraded, you should be able to safely roll back to 1.0.197 to do this. Restart Joplin, put your Nextcloud credentials in, and try to sync again.