Things lost after upgrade from 3.0.0-1 to 4.1.0

I’m trying to update to 4.1, however, afterwards my things list (created in paper-ui) is empty.
The startup logs are normal.

Only during the migration I got the errors below, however I assume, that those would not be the reason, would it?

Otherwise, how can I get to the cause of error?

[openHAB] Running JSON Database upgrade tool (${OPENHAB_RUNTIME}/bin/upgradetool.jar).
[main] INFO org.openhab.core.tools.internal.Upgrader - Copying item unit from state description to metadata in database '/var/lib/openhab/jsondb/org.openhab.core.items.Item.json'
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@234bef66'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - MultisensorOGBadTemperatur_Temperatur: Could not find thing for channel 'deconz:temperaturesensor:51430e3398:00158d00070886f2010402:temperature'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@50f8360d'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - MultisensorUGBadTemperatur_Temperatur: Could not find thing for channel 'deconz:temperaturesensor:51430e3398:00158d000588d2ee010402:temperature'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@2cb4c3ab'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - MultisensorOGBadLuftfeuchtigkeit_Luftfeuchtigkeit: Could not find thing for channel 'deconz:humiditysensor:51430e3398:00158d00070886f2010405:humidity'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@13c78c0b'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - Temperatursensortuya_Temperatur: Could not find thing for channel 'deconz:temperaturesensor:51430e3398:847127fffec2e227010402:temperature'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@12843fce'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - MultisensorUGBadLuftfeuchtigkeit_Luftfeuchtigkeit: Could not find thing for channel 'deconz:humiditysensor:51430e3398:00158d000588d2ee010405:humidity'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@3dd3bcd'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - PresenceToiletteHelligkeit_Temperatur: Could not find thing for channel 'deconz:lightsensor:51430e3398:00158d000700665c010400:temperature'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@97e1986'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - LuftfeuchtigkeitTuya_Luftfeuchtigkeit: Could not find thing for channel 'deconz:humiditysensor:51430e3398:847127fffec2e227010405:humidity'. Check if you need to set unit metadata.
[main] INFO org.openhab.core.tools.internal.Upgrader - PresenceToiletteTemperatur_Temperatur: Could not find thing for channel 'deconz:temperaturesensor:51430e3398:fa0ff28426:temperature'. Check if you need to set unit metadata.
[main] ERROR org.openhab.core.storage.json.internal.JsonStorage - Couldn't deserialize value 'org.openhab.core.storage.json.internal.StorageEntry@26f67b76'. Root cause is: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $.channels[0]
[main] INFO org.openhab.core.tools.internal.Upgrader - MultisensorOGBadLuftdruck_Druck: Could not find thing for channel 'deconz:pressuresensor:51430e3398:00158d00070886f2010403:pressure'. Check if you need to set unit metadata.
[main] INFO org.openhab.core.tools.internal.Upgrader - Upgrading JS profile configuration in database '/var/lib/openhab/jsondb/org.openhab.core.thing.link.ItemChannelLink.json'

Did you upgrade to Java 17?
If not you can get solutions here:

Yes I installed Java 17 and checked the version before migrating.

This error indicates that json file have {} instead of [] at some place. I am not quite sure why it would be stored differently because channel list is populated by OH itself. You can try to fix issue manually through modification of affected lines. Remember to backup file before messing with it. :wink:

This is the entry of the first errorous line in org.openhab.core.items.Item.json (prior to the migration, afterwards it’s also the same):

"MultisensorOGBadTemperatur_Temperatur": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [
        "MultisensorOGBadTemperatur",
        "RRD4J"
      ],
      "itemType": "Number:Temperature",
      "tags": [
        "Point"
      ],
      "label": "Temperatur",
      "category": "Temperature"
    }
  },

What should I change? It looks not bad to me.

This indeed looks ok, assuming that above above elements are also using {} i.e.:

{
  "MultisensorOGBadTemperatur_Temperatur": {
    ..
  }
}

Looking closer at the message, this file does not have any channels. It must be Thing.json which causes failure.

What would be a good way to approach get to the problem cause? Its a bit frustrating, that there are no error messages.

I could remove all elements exept one of the Thing.json (I try this now) - and try different ones and see if anything changes.

I guess your thing file would work fine, cause there is an internal migration mechanism within JsonStorageService which is able to handle stored elements using old layout (3.3.0M7 < ).

It happens that upgradetool works right above json file using storage interface instead of service interface where migration is done. I believe there is valid reason for this design, but I’ll let @J-N-K to elaborate more on it.

I found the source for the missing things. Following entry in the Thing.json prevented silently the loading procedure:
(for similar problems: The approach was to remove various elements from Things.json piece by piece and then test the functionality.)

"vitotronic:heating:6324035d37:3070a87cfc": {
    "class": "org.openhab.core.thing.internal.ThingImpl",
    "value": {
      "label": "Vitotronic",
      "bridgeUID": {
        "segments": [
          "vitotronic",
          "bridge",
          "6324035d37"
        ],
        "uid": "vitotronic:bridge:6324035d37"
      },
      "channels": [
        {
          "acceptedItemType": "DateTime",
          "kind": "STATE",
          "uid": {
            "segments": [
              "vitotronic",
              "heating",
              "6324035d37",
              "3070a87cfc",
              "systemtime"
            ],
            "uid": ""
          },
          "channelTypeUID": {
            "segments": [
              "vitotronic",
              "systemtime"
            ],
            "uid": "vitotronic:systemtime"
          },
          "label": "DateTime of the Heating System",
          "configuration": {
            "properties": {}
          },
          "properties": {},
          "defaultTags": []
        },
        {
          "acceptedItemType": "Number",
          "kind": "STATE",
          "uid": {
            "segments": [
              "vitotronic",
              "heating",
              "6324035d37",
              "3070a87cfc",
              "outside_temp"
            ],
            "uid": ""
          },
          "channelTypeUID": {
            "segments": [
              "vitotronic",
              "outside_temp"
            ],
            "uid": "vitotronic:outside_temp"
          },
          "label": "Outside Temperature",
          "description": "Outside temperature sensor",
          "configuration": {
            "properties": {}
          },
          "properties": {},
          "defaultTags": []
        },
        {
          "acceptedItemType": "Number",
          "kind": "STATE",
          "uid": {
            "segments": [
              "vitotronic",
              "heating",
              "6324035d37",
              "3070a87cfc",
              "boiler_temp"
            ],
            "uid": ""
          },
          "channelTypeUID": {
            "segments": [
              "vitotronic",
              "boiler_temp"
            ],
            "uid": "vitotronic:boiler_temp"
          },
          "label": "Boiler",
          "description": "Temperature sensor of boiler (fireplace)",
          "configuration": {
            "properties": {}
          },
          "properties": {},
          "defaultTags": []
        },
        {
          "acceptedItemType": "Switch",
          "kind": "STATE",
          "uid": {
            "segments": [
              "vitotronic",
              "heating",
              "6324035d37",
              "3070a87cfc",
              "malfunction"
            ],
            "uid": ""
          },
          "channelTypeUID": {
            "segments": [
              "vitotronic",
              "malfunction"
            ],
            "uid": "vitotronic:malfunction"
          },
          "label": "Heating Malfunction",
          "description": "General Malfunction state of the heating",
          "configuration": {
            "properties": {}
          },
          "properties": {},
          "defaultTags": []
        }
      ],
      "configuration": {
        "properties": {}
      },
      "properties": {},
      "uid": {
        "segments": [
          "vitotronic",
          "heating",
          "6324035d37",
          "3070a87cfc"
        ],
        "uid": "vitotronic:heating:6324035d37:3070a87cfc"
      },
      "thingTypeUID": {
        "segments": [
          "vitotronic",
          "heating"
        ],
        "uid": ""
      }
    }

it belonged to following bridge:

"vitotronic:bridge:6324035d37": {
    "class": "org.openhab.core.thing.internal.BridgeImpl",
    "value": {
      "label": "Bridge Vitotronic Optolink Adapter",
      "channels": [],
      "configuration": {
        "properties": {
          "adapterID": "300P",
          "ipAddress": "10.1.0.45",
          "port": 31113,
          "refreshInterval": 300
        }
      },
      "properties": {},
      "uid": {
        "segments": [
          "vitotronic",
          "bridge",
          "6324035d37"
        ],
        "uid": "vitotronic:bridge:6324035d37"
      },
      "thingTypeUID": {
        "segments": [
          "vitotronic",
          "bridge"
        ],
        "uid": ""
      }
    }
  }