OH4 - java.lang.IllegalArgumentException: Last segment must not be blank:

Hi,

I´m running OH 4.0.3 and I get this errors in the log:

java.lang.IllegalArgumentException: Last segment must not be blank: [shelly, shellyplugs, ]

when I look into org.openhab.core.items.Item.json

{
  "AQ_Hauptstrom_shellyplugsab90be1921688683_Stromverbrauch": {
    "class": "org.openhab.core.items.ManagedItemProvider$PersistedItem",
    "value": {
      "groupNames": [],
      "itemType": "Number:Power",
      "tags": [
        "Current",
        "Measurement"
      ],
      "label": "Stromverbrauch",
      "category": "Energy"
    }
  }
}

in org.openhab.core.thing.link.ItemChannelLink.json

{
  "AQ_Hauptstrom_shellyplugsab90be1921688683_Stromverbrauch -\u003e shelly:shellyplugs:ab90be:meter#currentWatts": {
    "class": "org.openhab.core.thing.link.ItemChannelLink",
    "value": {
      "channelUID": {
        "segments": [
          "shelly",
          "shellyplugs",
          "ab90be",
          "meter#currentWatts"
        ],
        "uid": "shelly:shellyplugs:ab90be:meter#currentWatts"
      },
      "configuration": {
        "properties": {}
      },
      "itemName": "AQ_Hauptstrom_shellyplugsab90be1921688683_Stromverbrauch"
    }
  },
  "Sure_Petcare_API_Konto_Aktualisieren -\u003e surepetcare:bridge:3df5a47726:refresh": {
    "class": "org.openhab.core.thing.link.ItemChannelLink",
    "value": {
      "channelUID": {
        "segments": [
          "surepetcare",
          "bridge",
          "3df5a47726",
          "refresh"
        ],
        "uid": "surepetcare:bridge:3df5a47726:refresh"
      },
      "configuration": {
        "properties": {}
      },
      "itemName": "Sure_Petcare_API_Konto_Aktualisieren"
    }
  }
}

it looks correct. What I´m missing?

Thanks

Paul

Is there a stack trace? I would guess this is coming from a Thing.

Hi,

sorry maybe a stupid question. I have increased the log levels for things to TRACE and restarted OH. Now I have a quite big logfile. What should I look for?

Thanks

Paul

Usually when you see an exception there will be a stack trace under it showing all the classes that called each other until they got to where the error occured. You’ll see a lot of “caused by”.

It has nothing to do with the logging level usually.

ok got it.

 3301 2023-09-25 16:00:00.081 [WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: Last segment must not be blank: [shelly, shellyplugs, ]
   3302 java.lang.IllegalArgumentException: Last segment must not be blank: [shelly, shellyplugs, ]
   3303         at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:79) ~[?:?]
   3304         at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:59) ~[?:?]
   3305         at org.openhab.core.thing.UID.<init>(UID.java:57) ~[?:?]
   3306         at org.openhab.core.thing.ThingUID.<init>(ThingUID.java:139) ~[?:?]
   3307         at org.openhab.core.thing.ChannelUID.getThingUID(ChannelUID.java:150) ~[?:?]
   3308         at org.openhab.core.thing.internal.AutoUpdateManager.shouldAutoUpdate(AutoUpdateManager.java:205) ~[?:?]
   3309         at org.openhab.core.thing.internal.AutoUpdateManager.receiveCommand(AutoUpdateManager.java:145) ~[?:?]
   3310         at org.openhab.core.thing.internal.CommunicationManager.receiveCommand(CommunicationManager.java:335) ~[?:?]
   3311         at org.openhab.core.thing.internal.CommunicationManager.receive(CommunicationManager.java:190) ~[?:?]
   3312         at org.openhab.core.internal.events.EventHandler.lambda$2(EventHandler.java:168) ~[?:?]
   3313         at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?]
   3314         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
   3315         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
   3316         at java.lang.Thread.run(Thread.java:833) ~[?:?]

I’m not sure where to go from here except the following:

  1. try recreating/rediscovering the Thing and re-link it to your Item
  2. if that doesn’t work file an issue on the Shelly binding.

I unlinked the thing and removed it. Deleted the item and did a scan from the shelly binding. Recreated the thing and the links. After a reboot everything looks normal but the exception is still there

2023-09-25 21:27:25.899 [ERROR] [ore.common.registry.AbstractRegistry] - Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier@19656409" about the "ADDED" event: Last segment must not be blank: [shelly, shellyplugs, ]
java.lang.IllegalArgumentException: Last segment must not be blank: [shelly, shellyplugs, ]
        at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:79) ~[?:?]
        at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:59) ~[?:?]
        at org.openhab.core.thing.UID.<init>(UID.java:57) ~[?:?]
        at org.openhab.core.thing.ThingUID.<init>(ThingUID.java:139) ~[?:?]
        at org.openhab.core.thing.ChannelUID.getThingUID(ChannelUID.java:150) ~[?:?]
        at org.openhab.core.thing.internal.ChannelLinkNotifier.added(ChannelLinkNotifier.java:70) ~[?:?]
        at org.openhab.core.thing.internal.ChannelLinkNotifier.added(ChannelLinkNotifier.java:1) ~[?:?]
        at org.openhab.core.common.registry.AbstractRegistry.notifyListeners(AbstractRegistry.java:375) ~[?:?]
        at org.openhab.core.common.registry.AbstractRegistry.notifyListenersAboutAddedElement(AbstractRegistry.java:408) ~[?:?]
        at org.openhab.core.thing.link.ItemChannelLinkRegistry.notifyListenersAboutAddedElement(ItemChannelLinkRegistry.java:181) ~[?:?]
        at org.openhab.core.thing.link.ItemChannelLinkRegistry.notifyListenersAboutAddedElement(ItemChannelLinkRegistry.java:1) ~[?:?]
        at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
        at org.openhab.core.common.registry.AbstractRegistry.addProvider(AbstractRegistry.java:440) ~[?:?]
        at org.openhab.core.common.registry.AbstractRegistry$ProviderTracker.addingService(AbstractRegistry.java:149) ~[?:?]
        at org.openhab.core.common.registry.AbstractRegistry$ProviderTracker.addingService(AbstractRegistry.java:1) ~[?:?]
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943) ~[osgi.core-8.0.0.jar:?]
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871) ~[osgi.core-8.0.0.jar:?]
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[osgi.core-8.0.0.jar:?]
        at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[osgi.core-8.0.0.jar:?]
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:321) ~[osgi.core-8.0.0.jar:?]
        at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:264) ~[osgi.core-8.0.0.jar:?]
        at org.openhab.core.common.registry.AbstractRegistry.lambda$0(AbstractRegistry.java:111) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
        at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?]
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
        at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]

I will raise an issue - when I discovered how to do this

Many thanks

Paul

Issue created - I hope I didn´t do something stupid