In case of "bad state" response when typing S CONFIG.MODE SYNC_DB you can type the following command to reset the synchronisation state:

S CONFIG.STATE RESET

Then try again S CONFIG.MODE SYNC_DB