Item * could not be found in the item registry

I try to get OpenHab 2.5.8 working - but I really get frustrated about it. I´m spending hours to figure out even to get the most simple stuff sorted out as the documentation does not really help me. Sorry for that.
I have created a couple of items in PaperUI and now I switch to VS Code.
I created a items file and added some items that I try referring from a sitemaps file.
VS Code autocomplete does not always show the new items and I also get the feedback (from log … Item * could not be found in the item registry). I really have no clue where to start looking.
For me openhab is absolutely not usable this way. There is simply no info an what is wrong / no proper documentation…
Any ideas where to start?

Show us your Items and Sitemap file, using code fences (three backticks ```):

```
Like this
```

Also, make sure you are not making duplicate Items which already exist from PaperUI.

That one is pretty clear. In your sitemap you have a widget with item=*, but there is no Item * in your system.
That might be because you have a typo in the name, or something else wrong with your xxx.items file stops it loading (see your openhab.log).
Item names are case sensitive.

I really would like to do this myself but the existing docu is somehow not really helpful as it does not provide the complete syntax of the files. So many thanks for looking at this. The item is there. But the parser somehow stops at some point and does not really report what´s actually wrong.
The fing has been defined in PaperUI and has another item linked to it (in paper UI). But this should not be a problem to my understanding. I also do get these issues with other names.

some.items

Switch PumpeMitTimer “Pumpe an mit Timer” {channel=“shelly:shelly1:500291f09ead:relay#output”}
Number timer_LaufzeitPumpe “Pumpe Laufzeit [%d] min” <time>

home.sitemap:
sitemap home label=“Zu Hause”
{
Frame label=“Garten”
{
Switch item=Pumpe
Switch item=PumpeMitTimer
Setpoint item=timer_LaufzeitPumpe step=1 minValue=0 maxValue=30
}

Frame label="Other Frame"
{


}
}

Exception: org.eclipse.smarthome.core.items.ItemNotFoundException: Item ‘PumpeMitTimer’ could not be found in the item registry

If this item has not been created, the problem in your .items file is somewhere before the line that creates this item!

Do you really mix items created via PaperUI (by the simple Mode?) and by an .items file? You will run into issues because of duplicates!

What makes you think “the parser stops”? Is there an openhab.log message you would like to share?

The documentation is fairly extensive with many examples. Please highlight what you think is missing

2 Likes

Just spotted, that is a bit uhh unconventional. No idea if it throws an error.
"Some text [%d min]"
would be usual way

Short answer: it works now. However the code ist still the same (at least this is my interpretation). It started to work once I have removed time Number Item and its Setpoint. So the issue was not the Switch Item that was reported to be not available in the log.
Unfortunately I do not find what I have changed. Sorry for that, this is weird. Without proof my gut feeling is that OpenHab is not very good in spotting and properly reporting syntax problems in the code. Looking at other problem being discussed in this forum this seems to be a generel issue.Lots of guessing what could be wrog. Do you have some sort of properly managed compiler fronted to pars the code or is this a custom “hand written” parser? VC Code is not very good in enforcing the required code style.Are there some thought to use something more formal such as JSON or XML?
Anyhow! Thanks for your kind help.

I pointed out one anomaly with your Number Item already, the label format
"Pumpe Laufzeit [%d] min"
which is not described in any documentation or shown in any examples.
Out of curiosity I gave it a try - it doesn’t break anything, although the
" min"
part is just ignored unsurprisingly, and will not be displayed. So that’s not your real problem.

A common mistake is using the wrong kind quotemarks in config files, especially if copy/pasting content with “marks”.
It is not possible to say if that happened to you because you did not paste your faulty file in code fences, and so this forum will re-format as ordinary text.
Illustration -

"these are good quotemarks"
“these are  bad quotemarks”

Both VSCode editor and items file parser will complain about the wrong ones.

As already said to you, if there is something wrong in one line of your xxx.items file, it is quite likely to ruin everything else.

I think we’ll wait on any concrete examples you can give of what goes wrong for you or what find lacking in the documentation.

If you want to rummage in code, it’s all an open book on Github.

1 Like

Inarisee,
If it is any consolation, I just ran into similar problems. I kept getting:
" item does not exist in the registry".
I have only 2 items in the items file and the sitemap, a Switch named LED and a Contact named Button. I was getting the message when I toggled the LED.
I found:


2020-10-08 20:50:07.160 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.sitemap.Switch

2020-10-08 20:50:07.162 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'LED' for widget org.eclipse.smarthome.model.sitemap.sitemap.Switch

2020-10-08 20:50:07.166 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'LED' for widget org.eclipse.smarthome.model.sitemap.sitemap.Switch

2020-10-08 20:50:07.171 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'LED' for widget org.eclipse.smarthome.model.sitemap.sitemap.Switch

2020-10-08 20:50:07.174 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.sitemap.Text

2020-10-08 20:50:07.177 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Button' for widget org.eclipse.smarthome.model.sitemap.sitemap.Text

2020-10-08 20:50:07.179 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Button' for widget org.eclipse.smarthome.model.sitemap.sitemap.Text

2020-10-08 20:50:07.182 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Button' for widget org.eclipse.smarthome.model.sitemap.sitemap.Text  

So while trying everything I could think of, I changed LED to LEDx and the 5 error lines for LED stopped being reported.
So I changed Button to Buttonx and those 5 error lines for Button stopped being reported. So I changed them back to LED and Button and still no errors and my rules started working.
These item, sitemap and rules all worked yesterday. Today I wanted to make some changes but I wanted to preserved the existing state by saving the three files under different names. Then I started making my changes. Nothing worked so I kept backing off until I was back to copy and paste from yesterday’s files and I encountered the error described above and fixed as above. I have no idea why.

I have an issue just that very much resembles yours:

I have a couple of Chromecast devices that repeatedly can’t be found in the item registry using ScriptServiceUtil.getItemRegistry.getItem(), but normal event.ItemChangedEvents “finds” them:

2020-10-10 13:55:29.891 [vent.ItemStateChangedEvent] - ChromeCast_Audio_LivingRoom_AppName changed from UNDEF to Spotify

2020-10-10 13:55:34.950 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is playing music': Item 'Chromecast_Audio_LivingRoom_AppName' could not be found in the item registry

2020-10-10 13:57:12.868 [vent.ItemStateChangedEvent] - ChromeCast_Audio_LivingRoom_AppName changed from Spotify to UNDEF

2020-10-10 14:03:37.958 [vent.ItemStateChangedEvent] - ChromeCast_Audio_LivingRoom_AppName changed from UNDEF to Spotify

2020-10-10 14:03:41.495 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is playing music': Item 'Chromecast_Audio_LivingRoom_AppName' could not be found in the item registry

2020-10-10 14:03:59.394 [vent.ItemStateChangedEvent] - ChromeCast_Audio_LivingRoom_AppName changed from Spotify to UNDEF

The error occurs in a rule that detects a change appName and finds the track information

rule "One or more Chromecast is playing music"
when
    Member of Chromecasts_MediaType changed
then
    val Number count = Chromecasts_MediaType.members.filter( l | l.state != UNDEF && l.state != NULL && l.state.toString != "GENERIC").size
    logInfo(logger, "Chromecasts' playing some kind of media: {} ", count)

    Chromecasts_MediaType.members.filter[ l | l.state != UNDEF &&  l.state != NULL && l.state.toString != "GENERIC" ].forEach[
        chromeCast | logInfo("Logger","chromeCast: " + chromeCast.name + " State: " + chromeCast.state.toString)

        var String baseName = chromeCast.name.substring(0, chromeCast.name.lastIndexOf('_MediaType'))
        logInfo(logger, "baseName: " + baseName)

        // _Title
        var String titleItemName = baseName + "_Title"     
        var titleItemItem = ScriptServiceUtil.getItemRegistry.getItem(titleItemName)

        if (titleItemItem.state.toString != titleItemValue)
        {
            titleItemValue = titleItemItem.state.toString
        }
        
        // _Album
        var String albumItemName = baseName + "_Album"     
        var albumItemItem = ScriptServiceUtil.getItemRegistry.getItem(albumItemName)
        
        if (albumItemItem.state.toString != albumItemValue)
        {
            albumItemValue = albumItemItem.state.toString
        }

        // _Artist 
        var String artistItemName = baseName + "_Artist"     
        var artistItemItem = ScriptServiceUtil.getItemRegistry.getItem(artistItemName)
        
        if (artistItemItem.state.toString != artistItemValue)
        {
            artistItemValue = artistItemItem.state.toString
        }

        // _AlbumArtist albumArtistItemValue
        var String albumArtistItemName = baseName + "_AlbumArtist"     
        var albumArtistItemItem = ScriptServiceUtil.getItemRegistry.getItem(albumArtistItemName)

        if (albumArtistItemItem.state.toString != albumArtistItemValue)
        {
            albumArtistItemValue = albumArtistItemItem.state.toString
        }

        // _ImageURL
        var String urlItemName = baseName + "_ImageURL"     
        var urlItemItem = ScriptServiceUtil.getItemRegistry.getItem(urlItemName)

        if (urlItemItem.state.toString != urlItemValue)
        {
            urlItemValue = urlItemItem.state.toString
        }

        // Media_App appNameItemValue
        // _AppName
        var String appNameItemName = baseName + "_AppName"     
        var appNameItemItem = ScriptServiceUtil.getItemRegistry.getItem(appNameItemName)

        if (appNameItemItem.state.toString != appNameItemValue)
        {
            appNameItemValue = appNameItemItem.state.toString
        }
        
        logInfo(logger, "Artist: {} AlbumArtist: {} Title: {} Album: {} ImageURL: {}  ", artistItemValue, albumArtistItemValue, titleItemValue, albumItemValue, urlItemValue )                  
    ]
  
    // Post media information to sitemap items
    Media_Artist.postUpdate(artistItemValue)
    Media_AlbumArtist.postUpdate(albumArtistItemValue)
    Media_Title.postUpdate(titleItemValue)
    Media_Album.postUpdate(albumItemValue)
    Media_ImageURL.postUpdate(urlItemValue)
    Media_App.postUpdate(appNameItemValue)

end

I’ve verified that there are no “uppercase/lowercase” differences between the items in the items and the items displayed in the error message. I’ve tried to rename the item, I’ve tried to touch the file. All the other items in the same items file are working just fine. All the items follow the same naming scheme and the other items are found just fine.

The rule you’ve shown us should produce other log messages before getting to script util doings. Are those absent? This would be a clue to something more mysterious going on.

Not a problem. Here are all the log entries from that rule:

2020-10-09 12:29:42.581 [INFO ] [thome.model.script.chromecasts.rules] - Chromecasts doing something: 4 
2020-10-09 12:29:42.582 [INFO ] [thome.model.script.chromecasts.rules] - Chromecasts doing something: 4 
2020-10-09 12:29:42.621 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_MasterBedroom_AppName State: Backdrop
2020-10-09 12:29:42.625 [INFO ] [thome.model.script.chromecasts.rules] - Chromecasts doing something: 4 
2020-10-09 12:29:42.633 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_MasterBedroom
2020-10-09 12:29:42.659 [INFO ] [thome.model.script.chromecasts.rules] - Chromecasts doing something: 4 
2020-10-09 12:29:42.661 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_MasterBedroom_MediaType state: GENERIC 
2020-10-09 12:29:42.671 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_MasterBedroom_AppName State: Backdrop
2020-10-09 12:29:42.696 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_MasterBedroom_AppName State: Backdrop
2020-10-09 12:29:42.709 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_MasterBedroom
2020-10-09 12:29:42.714 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_MasterBedroom
2020-10-09 12:29:42.705 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_MasterBedroom_AppName State: Backdrop
2020-10-09 12:29:42.717 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_MasterBedroom_MediaType state: GENERIC 
2020-10-09 12:29:42.731 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_MasterBedroom_MediaType state: GENERIC 
2020-10-09 12:29:42.707 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_MasterBedroom
2020-10-09 12:29:42.707 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_Kitchen_AppName State: Backdrop
2020-10-09 12:29:42.753 [INFO ] [thome.model.script.chromecasts.rules] - Chromecasts' playing some kind of media: 1 
2020-10-09 12:29:42.756 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_MasterBedroom_MediaType state: GENERIC 
2020-10-09 12:29:42.758 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_Kitchen
2020-10-09 12:29:42.785 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_Kitchen_AppName State: Backdrop
2020-10-09 12:29:42.786 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_Kitchen_MediaType state: GENERIC 
2020-10-09 12:29:42.805 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_Kitchen_AppName State: Backdrop
2020-10-09 12:29:42.836 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_Kitchen
2020-10-09 12:29:42.836 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_Kitchen
2020-10-09 12:29:42.850 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Home_Kitchen_AppName State: Backdrop
2020-10-09 12:29:42.863 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_Kitchen_MediaType state: GENERIC 
2020-10-09 12:29:42.858 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_Kitchen_MediaType state: GENERIC 
2020-10-09 12:29:42.858 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Home_Kitchen
2020-10-09 12:29:42.886 [INFO ] [thome.model.script.chromecasts.rules] - deviceItem: ChromeCast_Home_Kitchen_MediaType state: GENERIC 
2020-10-09 12:29:42.893 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Audio_LivingRoom_AppName State: Spotify
2020-10-09 12:29:42.915 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Audio_LivingRoom
2020-10-09 12:29:42.943 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is doing something': Item 'ChromeCast_Audio_LivingRoom_MediaType' could not be found in the item registry
2020-10-09 12:29:42.957 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Audio_LivingRoom_AppName State: Spotify
2020-10-09 12:29:42.973 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Audio_LivingRoom_AppName State: Spotify
2020-10-09 12:29:42.960 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: ChromeCast_Audio_LivingRoom_AppName State: Spotify
2020-10-09 12:29:42.979 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Audio_LivingRoom
2020-10-09 12:29:42.985 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Audio_LivingRoom
2020-10-09 12:29:43.001 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is doing something': Item 'ChromeCast_Audio_LivingRoom_MediaType' could not be found in the item registry
2020-10-09 12:29:43.007 [INFO ] [thome.model.script.chromecasts.rules] - baseName: ChromeCast_Audio_LivingRoom
2020-10-09 12:29:43.013 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is doing something': Item 'ChromeCast_Audio_LivingRoom_MediaType' could not be found in the item registry
2020-10-09 12:29:43.003 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is doing something': Item 'ChromeCast_Audio_LivingRoom_MediaType' could not be found in the item registry
2020-10-09 12:29:43.032 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: Chromecast_Audio_LivingRoom_MediaType State: MUSIC_TRACK
2020-10-09 12:29:43.063 [INFO ] [thome.model.script.chromecasts.rules] - baseName: Chromecast_Audio_LivingRoom
2020-10-09 12:29:43.128 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is playing music': Item 'Chromecast_Audio_LivingRoom_AppName' could not be found in the item registry
2020-10-09 12:29:43.185 [INFO ] [thome.model.script.chromecasts.rules] - Chromecasts' playing some kind of media: 1 
2020-10-09 12:29:43.277 [INFO ] [clipse.smarthome.model.script.Logger] - chromeCast: Chromecast_Audio_LivingRoom_MediaType State: MUSIC_TRACK
2020-10-09 12:29:43.287 [INFO ] [thome.model.script.chromecasts.rules] - baseName: Chromecast_Audio_LivingRoom
2020-10-09 12:29:43.311 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'One or more Chromecast is playing music': Item 'Chromecast_Audio_LivingRoom_AppName' could not be found in the item registry

That’s interesting; you appear to have four copies of the rule started and running simultaneously. Presumably many chromecasts can change subject at much the same time.
I haven’t worked out the consequences but you’ve almost certainly run into some re-entrancy mess up.

It is known that searching in group.members while the group is actively updating can return null results, so there’s definitely a risk of that at the beginning of the rule. Does not seem to be the error you encounter, but I suppose it’s possible you have run into the underlying cause by a different route.

It strikes me that you could structure this differently … it seems odd to rummage through the members of a group, when the results get posted to just one common set of Items. Whatever goes on, only the last results stand. Could you not process just the triggering Item?