[SOLVED] Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier": Last segment must not be blank

Hi there,

I think I need your help. I am stuck since a few days with following (probably self-induced) error in my config, preventing the UI reaching the REST-API.

I already remove all file configured items, but the error still occures, so I think I messed up a config defined in the UI - but due to the error, the UI is not fully reachable to troubleshoot.

Searching the internet didn’t lead me to any hints.
So please, if anybody can show me the right direction, where I can find my misconfigured item/thing/ui or which “last segment” will lead the listener org.openhab.core.thing.internal.ChannelLinkNotifier to fail will be highly appreciated.

Thank you so much.

  • Platform information:
    • Hardware: CPUArchitecture/RAM/storage
    • OS: ubuntu 20.04
    • Docker Image: openhab/openhab:3.3.0
  • Issue of the topic:
[ERROR] [core.common.registry.AbstractRegistry] - Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier@7f66d798" about the "ADDED" event: Last segment must not be blank.
java.lang.IllegalArgumentException: Last segment must not be blank.
	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:367) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.notifyListenersAboutAddedElement(AbstractRegistry.java:400) ~[?:?]
	at org.openhab.core.thing.link.ItemChannelLinkRegistry.notifyListenersAboutAddedElement(ItemChannelLinkRegistry.java:138) ~[?:?]
	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:432) ~[?:?]
	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-7.0.0.jar:?]
	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:871) ~[osgi.core-7.0.0.jar:?]
	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[osgi.core-7.0.0.jar:?]
	at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[osgi.core-7.0.0.jar:?]
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:321) ~[osgi.core-7.0.0.jar:?]
	at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:264) ~[osgi.core-7.0.0.jar:?]
	at org.openhab.core.common.registry.AbstractRegistry.lambda$0(AbstractRegistry.java:111) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700) [?:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692) [?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) [?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) [?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) [?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) [?:?]

UI or file based config?

I use both.
When starting a new docker image with my text defined config only, the openhab instance works without any problems.
So am I right, if i suspect, that there should be something wrong in the jsondb folder? (which I didn’t edit manually before)

So is there any way how I can identify which of part of the config is responsible. Maybe by tracking down the id of the ChannelLinkNotifier@7f66d798 - 7f66d798 in the above case?

To clarify: The Items and Model Page in the UI remains empty, cause the corresponding json can not be created on the API side. Following error message in the log when try to visit these pages:

[ERROR] [org.apache.cxf.jaxrs.utils.JAXRSUtils] - Problem with writing the data, class org.openhab.core.io.rest.Stream2JSONInputStream, ContentType: application/json
[ERROR] [.internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.
java.lang.IllegalArgumentException: Last segment must not be blank.
	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.ThingRegistryImpl.getChannel(ThingRegistryImpl.java:80) ~[?:?]
	at org.openhab.core.thing.internal.ChannelStateDescriptionProvider.getStateDescription(ChannelStateDescriptionProvider.java:97) ~[?:?]
	at org.openhab.core.thing.internal.ChannelStateDescriptionProvider.getStateDescriptionFragment(ChannelStateDescriptionProvider.java:86) ~[?:?]
	at org.openhab.core.internal.service.StateDescriptionServiceImpl.getMergedStateDescriptionFragments(StateDescriptionServiceImpl.java:71) ~[?:?]
	at org.openhab.core.internal.service.StateDescriptionServiceImpl.getStateDescription(StateDescriptionServiceImpl.java:63) ~[?:?]
	at org.openhab.core.items.GenericItem.getStateDescription(GenericItem.java:409) ~[?:?]
	at org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper.considerTransformation(EnrichedItemDTOMapper.java:143) ~[?:?]
	at org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper.map(EnrichedItemDTOMapper.java:81) ~[?:?]
	at org.openhab.core.io.rest.core.item.EnrichedItemDTOMapper.map(EnrichedItemDTOMapper.java:64) ~[?:?]
	at org.openhab.core.io.rest.core.internal.item.ItemResource.lambda$2(ItemResource.java:219) ~[?:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
	at java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1642) ~[?:?]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294) ~[?:?]
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206) ~[?:?]
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169) ~[?:?]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300) ~[?:?]
	at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) ~[?:?]
	at org.openhab.core.io.rest.Stream2JSONInputStream.fillBuffer(Stream2JSONInputStream.java:91) ~[?:?]
	at org.openhab.core.io.rest.Stream2JSONInputStream.read(Stream2JSONInputStream.java:67) ~[?:?]
	at java.io.InputStream.read(InputStream.java:280) ~[?:?]
	at java.io.InputStream.transferTo(InputStream.java:704) ~[?:?]
	at org.openhab.core.io.rest.core.internal.GsonMessageBodyWriter.writeTo(GsonMessageBodyWriter.java:83) ~[?:?]
	at org.openhab.core.io.rest.core.internal.MediaTypeExtension.writeTo(MediaTypeExtension.java:84) ~[?:?]
	at org.apache.cxf.jaxrs.utils.JAXRSUtils.writeMessageBody(JAXRSUtils.java:1543) ~[bundleFile:3.4.5]
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.serializeMessage(JAXRSOutInterceptor.java:249) ~[bundleFile:3.4.5]
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.processResponse(JAXRSOutInterceptor.java:122) ~[bundleFile:3.4.5]
	at org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor.handleMessage(JAXRSOutInterceptor.java:84) ~[bundleFile:3.4.5]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[bundleFile:3.4.5]
	at org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:90) ~[bundleFile:3.4.5]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298) ~[bundleFile:3.4.5]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:222) ~[bundleFile:3.4.5]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[bundleFile:3.1.0]
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273) ~[bundleFile:3.4.5]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:550) ~[bundleFile:9.4.46.v20220331]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:74) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440) ~[bundleFile:9.4.46.v20220331]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:294) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[bundleFile:9.4.46.v20220331]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:90) ~[bundleFile:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487) ~[bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883) [bundleFile:9.4.46.v20220331]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034) [bundleFile:9.4.46.v20220331]
	at java.lang.Thread.run(Thread.java:829) [?:?]

In OH 3.4.0-SNAPSHOT the error message has been improved (Improve UID error message by J-N-K · Pull Request #3022 · openhab/openhab-core · GitHub) and now shows which UID is affected. Otherwise it’s hard to go through the JSON database by hand.

Thank you so much! I ran the 3.4.0-snapshot image on a copy of my setup and was able to purge the zombie IKEA tradfri Item out.

You saved my day!

[ERROR] [core.common.registry.AbstractRegistry] - Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier@1ed41f21" about the "ADDED" event: Last segment must not be blank: [tradfri, 0820, ikeaGW, ScB01, ]
java.lang.IllegalArgumentException: Last segment must not be blank: [tradfri, 0820, ikeaGW, ScB01, ]

Hi, Noticed marked as solved but my system running 4.0.1 with all config in UI has a similar message when starting OpenHAB:

023-08-15 15:56:28.588 [ERROR] [ore.common.registry.AbstractRegistry] - Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier@21265da5" about the "ADDED" event: Last segment must not be blank: [dmx, dimmer, universe, ]
java.lang.IllegalArgumentException: Last segment must not be blank: [dmx, dimmer, universe, ]

Double checked all my items that are linked to a DMX thing, then checked all 2915 items by filtering on state NULL figuring that it must be an item that is not working correctly. Was good exercise to clean some mistakes but the error message remains. Doesn’t seem to create an issue right now but after a couple of days on this I’m out of ideas how to proceed as I would like my boot log to be error free for when I do get an issue.

Any suggestions how I can trace what I understand from above discussion is an .misconfigured item?

Have a look in your configs for dmx:dimmer:universe:. It might be in some stale file which somehow still gets pulled in.

Hi Lukasz, thanks for your feedback. I checked the following:

  • File based config, all folders are empty. Only file config left is persist, all config in UI.
  • UI Checked things by binding, both bridges and all DMX things are online.
  • UI Items, checked all items with a channel configured to DMX but did not find any errors.
  • Checked all items with NULL value to see if there was something there but none have channels
  • Tried increasing logging to DEBUG on various modules but other then really big logs no extra detail on the error. Was trying module by module as I’m not sure which module is producing this error.
  • Tried to use the API but the items and channels are not available as one record unless I’m mistaken.

If there is an error it must be in the OpenHAB config file/database but not sure how to read that. This config is in use since OH 3 when I started fresh upgrading from OH 2 so I is posible something hangs somewhere I guess.

Look at jsondb files (userdata/jsondb/*.json) - it might be that it contains some stale entry which is not visible in UI but retained over updates. There are two files - primary point of interest for you is ItemChannelLink (afair).

1 Like

Found the ItemChannelLink file, need to look deeper tomorrow but this is what I see now as there is 30k lines in it:

  • I have 54 DMX Dimmer channels in use (Actual configured in the UI) on 2 universes.
  • The file has 65 DXM Dimmer items, found some that are deleted years ago but still there.
  • There are 10 Items with UID universe4 which does not exsist anymore explaning all but 1 discrepency.

Should I delete these from the JSON file? and which other file would be interesting to look at for stale items?

Just confirmed, theItemChannelLink file has 77 stale items with DMX configs with 10 of them even being incomplete with config dmx:dimmer:universe::brightness missing the universe number and channel number. Made a backup, deleted the 77 and did several restarts. Happy to report the error is gone, thank you very much for that.

More worrying is that there are now approx. 1230 items in this file while I have only 650 actual things so over the years it seems there is a bug not cleaning this file. Next, clean the other 600 or so items.

There is a karaf command to remove dangling links (i.e. either channel or item not present). I can‘t remember the name right now, but type openhab: and press tab, you should see the available commands.

2 Likes

Thanks Jan, that saved me a lot of time and potential issues. The command I found and used is:

openhab:links orphan purge

The JSON dropped from 30,000 to 20,000 lines :slight_smile:

1 Like

Just in case it’s interesting for others: You can even get rid of orphaned links via UI: Under “developer tools - API explorer - links” you find “Remove unused/orphaned links”

2 Likes