Accidentally, I made a typo when defining an OH3-item in a textual file by adding an extra “:” in the channel field:
DateTime LocalNTPDateTime "Datum & Zeit" {channel="ntp:ntp:local::dateTime"}
In the log file there are warnings and error messages
[WARN ] [ab.core.internal.events.EventHandler] - Dispatching/filtering event for subscriber 'org.openhab.core.events.EventSubscriber' failed: Last segment must not be blank.
java.lang.IllegalArgumentException: Last segment must not be blank.
[....]
[ERROR] [ore.common.registry.AbstractRegistry] - Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier@b559c2" about the "UPDATED" event: Last segment must not be blank.
If you overlook or do not understand these warnings (as I did) the openHAB REST API crashes for items as can be seen e.g. here:
(1) Output of
curl -X GET --header “Accept: application/json” “http://192.xxx.xxx.xxx:8080/rest/items?recursive=false”
ends with
{\"error\":{\"message\":\"Last segment must not be blank.\",\"http-code\":500,\"exception\":{\"class\":\"java.lang.IllegalArgumentException\",\"message\":\"Last segment must not be blank.\",\"localized-message\":\"Last segment must not be blank.\"}}}
(2) The items explorer in the Main UI
loops and shows no result at all
(3) The openHAB Addin for Visual Studio Code shows this error message:
Could not reload items for HoverProvider
---
Error:
Error while connecting to openHAB REST API.
Message:
TypeError: e.data.forEach is not a function
---
The simple solution is to correct the erroneous “::” in the items declaration and restart the system “clean-cache”.
Suggestions:
- Provide additional information about this erroneous item definition in the log files (e.g. item file name, channel and/or item)
- Ignore incorrect item declarations in the REST API
Kind regards,
Joachim
openHAB 3.3.0 Release Build
Raspberry / Linux/5.10.103-v7l+ (arm)
Java Raspbian 11.0.16