I copy an explanation by @tessus from another thread:
" First, please backup your notes: Export -> JEX .

Then close Joplin and delete the profile directory. The profile dir can be found in Preferences (the General tab) - Notes and settings are stored in: xxxx"

If you are on Windows you find the Joplin directory in %userprofile%\.config. After that start Joplin and authenticate with your OneDrive. You should not switch synchronization targets when something is not working, this makes things worse.