4.2M1 downgrade to 4.1 causes JsonStorage - Couldn't deserialize value errors

I encountered problems upgrading from 4.1 to 4.2M2 so I decided to downgrade again. But unfortunately I am now getting JsonStorage - Couldn’t deserialize value errors. => How to fix?

2024-03-04 17:13:02.119 [ERROR] [re.storage.json.internal.JsonStorage] - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@5e3f9015'. Root cause is: java.lang.NumberFormatException: For input string: "2024-03-04T16:20:14.302672877Z"

Downgrade is not supported. You can replace all timestamps in userdata/org.openhab.core.config.discovery.DiscoveryResult.json with epoch milliseconds.

For example:

 "timestamp": "2024-01-09T20:17:27.818829400Z",

to:

"timestamp": 1699728096882,
1 Like

@laursen : I have the same issue. Can you please explain a little bit more what to do, as I’m not familiar with JasonDB. Thank you!

In that case the easiest solution is to delete the file userdata/org.openhab.core.config.discovery.DiscoveryResult.json (and by that remove all discovery results)

Just to be clear: This was a specific issue related to downgrading and/or using snapshot builds of 4.2. Which version are you on and what are you trying to do?

EDIT: Details here:

Thank you for the fast reply @laursen ! I upgraded accidentially my openhab container (I just wanted to change a few network settings, but pulled the latest docker image). So I upgraded from 4.1.3 to 4.2.2. Now I switch back.

I deleted the file, but the error is still recorded:

2024-11-18 14:00:21.805 [ERROR] [re.storage.json.internal.JsonStorage] - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@25fa2a22'. Root cause is: java.lang.NumberFormatException: For input string: "2024-11-13T19:59:17.114007650Z"

You probably need to delete the files from your backup directory as well:

openhabian@openhabian:/var/lib/openhab/jsondb $ ll backup/*Discovery*
-rw-r--r-- 1 openhab openhab 140K Nov 18 14:54 backup/1731938062555--org.openhab.core.config.discovery.DiscoveryResult.json
-rw-r--r-- 1 openhab openhab 140K Nov 18 14:56 backup/1731938178425--org.openhab.core.config.discovery.DiscoveryResult.json
-rw-r--r-- 1 openhab openhab 140K Nov 18 14:57 backup/1731938239317--org.openhab.core.config.discovery.DiscoveryResult.json
-rw-r--r-- 1 openhab openhab 140K Nov 18 14:58 backup/1731938298179--org.openhab.core.config.discovery.DiscoveryResult.json
-rw-r--r-- 1 openhab openhab 140K Nov 18 14:59 backup/1731938362556--org.openhab.core.config.discovery.DiscoveryResult.json
1 Like

That was the solution. Thanks!