When they do not load do you see anything in the logs? Errors during loading or lack of a log statement saying that the file was attempted to be loaded at all?
I can see this warning upon restart of the computer related to the problem I faced today:
2026-01-20 09:58:48.913 [WARN ] [el.core.internal.ModelRepositoryImpl] - DSL model 'lights.rules' has errors, therefore ignoring it: There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
I am not a software engineer, but I understand the explanation in the linked topic that it is better to avoid definition of the variable types.
I checked the rule file and I can only see the following declarations:
var Timer tmrLightHall
var Timer tmrLightOffice
var Timer tmrLightOfficeButton
var Timer tmrChristmassLights
var Timer tmrFrontEntranceLights
var Timer tmrLightBBQ
var Timer tmrLightKitchen
var Timer tmrLightCarport
var LightBedroomColorCurrentState = LightBedroomColor.state as HSBType
val pState = lamp.persistedState(now.minusDays(7), "rrd4j")
The last declaration appears 4 times, and that is “enhancement“ by Google Gemini that I used to correct ZonedDateTime warnings on my presence simulation that was working for 5-6 years.
I suspect this is the problem, since I see also 4 entries at the start.
On the other hand, if the machine is running and I tried changing the extension to something and back to rules, all started working. No logs no errors.
The warning shouldn’t be the root problem. For one it’s just a warning.
A “closure” in Rules DSL is any time you see stuff in square brackets: e.g. [ | some code].
In this case you have at least four cases where you have a closure (or lambda if you prefer that term, I hate that they use both) where you pass arguments: e.g. [arg 1 | some code]. Maybe in a call to forEach or something like that.
It’s weird that the error only sometimes occurs. But you can eliminate it as a problem by setting a type for the arguments passed to these lambdas.
You should at a minimum see “loading model filename.rules” or something like that.
OK, I set the logging to info and I only get log entry similar as above:
2026-01-27 09:13:38.331 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading DSL model 'lights.rules'
2026-01-27 09:13:39.993 [WARN ] [el.core.internal.ModelRepositoryImpl] - DSL model 'lights.rules' has errors, therefore ignoring it: There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
2026-01-27 09:13:39.994 [INFO ] [el.core.internal.ModelRepositoryImpl] - Unloading DSL model 'lights.rules'
Well, like I said above, you can eliminate these errors that appear sometimes while loading the file by supplying the type of the arguments to all lambdas. Based on the log you have five places in lights.rules where you have arguments passed to lambdas.
For the one you post the type would be [ GenericItem lamp |.
This does not appear to be related to the issue posted above because the file is loaded every time. It’s just that sometimes there are errors parsing the rules and other times there are no errors.
Since the upgrade to v5.1 I am facing that my text rules are randomly not loading on restart.
If I just change the file extension and then return it back to .rules all is loaded.
Are your items defined in .items files; .yaml files; in the MainUI (jsondb); or created dynamically by some (automation) add-on, e.g. using the provider preset?
Or in other words, can you find out, if (on boot) the rule is parsed before the items are loaded and then this error happens? If this is the case, it would at least explain why this happens sometimes - when the rules are partsed and the rule references not yet loaded items.
I think on boot different modules (bundles) are started in parallel, so on each boot the order in which bundles complete loading (starting) can be different.
works with openHAB 5.1 when g is a GroupItem and produces
DSL model 'starttest.rules' has errors, therefore ignoring it: There is no context to infer the closure's argument types from. Consider typing the arguments or put the closures into a typed context.
if I have no item g. So the above error happens sometimes, because sometimes the rule is parsed on booting before the items are loaded.