Script throws exception on openHAB startup, sometimes


currentl I am in the process of migrating to openHAB 2.

With openHAB 1 I was using the script to determine if the current day is a public holiday, which was posted somewhere in the openHAB Forum.

With openHAB 2 this script sonetimes throws the followinf exception:

2017-11-11 16:04:50.679 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::' failed.
java.lang.IllegalStateException: HolidayName uses unsupported uri fragment tmp_holiday.script#/1/@members.156

After restarting openHAB it usually works, but I have no idea what causes this exception, any hint would be helpfull for me!

Thanks for your help,

Add a log statement to print the URL to the log before you call it and see if there is a pattern with it when you get there error.

It took some days before the error occurred again.

I added a log statement right at the beginning of the script and even this statement is not logged when the error occurs. Currently I have the suspicion, that the error only occurs when the script is started with a “system started” trigger, but I have to do more testing to confirm this.

the problem is this line:


Any idea how to convert String (java) to String (OH)?

in scripts file:
var String holidayName = null

in items file:
String SpecialDay “Day [MAP(]”

You shouldn’t have to. What is the error you are seeing? The only think I can think of is that holidayName is still null when you call postUpdate. That wouldn’t work. But if holidayName is any sort of String that will work.

Sorry for not posting the complete syntax:

else if (dayOfYear==parse(year+"-12-31").getDayOfYear) {
    holidayName = "new_years_eve" // Silvester
    holiday = false
else {
    holidayName = "no_special_day"
    holiday = false


But the problem only comes on restart of OH, not if I start the rule manually or via cron.

We need to see the whole rule. These few lines do not give any context. For example, what the heck is dayOfYear and how is it populated? What do you do with holiday? Are any of these Items, local variables, global variables? If variables, are they populated from Items?

Hi Rich,

there is a parallel post here with all details:

I have the same error with the same script. But i didn’t find any solution in the other thread.
If i update openhab to the newest snapshot (i do that once a week or so) the first startup takes way longer than usual and the openhab.log is filled with the same errors. My script is called feestdag.script, but it is the exact same holiday.script from the same tutorial.
feestdag.txt (3.7 KB)

rule "Feestdagen"
	Time cron "0 0 0 * * ?" or
	System started
//partial stack trace: 
2019-08-25 21:00:31.814 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::' failed.
java.lang.IllegalStateException: ON uses unsupported uri fragment tmp_feestdag.script#/1/@members.6
	at org.eclipse.xtext.xbase.typesystem.internal.ScopeProviderAccess.getCandidateDescriptions( ~[?:?]
	at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.getLinkingCandidates( ~[?:?]
	at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer._computeTypes( ~[?:?]
	at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer.computeTypes( ~[?:?]
	at org.eclipse.smarthome.model.script.jvmmodel.ScriptTypeComputer.computeTypes( ~[?:?]
	at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.doComputeTypes( ~[?:?]
	at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.computeTypes( ~[?:?]
	at org.eclipse.xtext.xbase.typesystem.internal.AbstractLinkingCandidate.resolveArgumentType( ~[?:?]

There are known problems with rules becoming active before other parts of openHAB have completely initialized. Especially when it is a more long winded startup, such as after an upgrade or cache deletion.

Thinks, i might work something out with a timer as workaround. Do you know if there is some github issue/discussion? Maybe i can add this as an example to get a fix?
Because the script is not using any binding/addon/ui/io/action/persistence etc. It must be some core stuff that is not initialized yet. Without really knowing all the inner workings of openHAB, it seems wrong to start a rule while the core is not yet ready to start anything.

I believe this is the most general case

I have no real idea if your symptom is another manifestation of the general boot-order problem, it just feels like it.
Even if it is, it may need something else to be taken account in any eventual fix.

I would suggest it is worth opening a new github issue - I would guess against openhab core.

Sure. It’s a non-trivial mess to sort out though.


I’m getting the same error message since updating to 2.5.0 M2. The script is also the same but in my case adapted to german language. feiertag.script.txt (3.6 KB)

I did some tests and it seems not being related to the rule which is calling the script is triggered before everything is loaded. I removed the call to my script and still get the issue.
Hence it seems this error occurs already when the script file is loaded. The only solution I found is to completely remove the script file from openhab.

If I readd the file once openhab is up and running the error doesn’t occure.

Is there any idea, what I can do to solve this issue, since it is completely blocking openhab from completing startup?

Well spotted; this rang a bell. Files in the /scripts folder are parsed at load time (and edit/save), so you don’t need to call them to trigger an error.
Delaying rule execution doesn’t help, sorry.

I would still say this is to do with boot order, parsing scripts before all Items are available, and I’m not surprised if timing does change between versions.

That I do not know.

Okay. Thanks for your input.
So at least my observations make sense.

My main Problem is that the error is triggered continuously and blocking start-up.

I guess I’ll copy my code from script to the rule. Not nice but should solve it for the time being

This does not seem right at all. I just tried a nonsense script in 2.4.0 and it loads without complaint. Perhaps you could try this in 2.5 to see if it shows something up.


postUpdate(nonsenseItem, "rubbish")


2019-08-28 23:05:49.618 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'nonsense.script'

That loads properly you are right. However there seems to be something wired at the moment.

I copied the script back to /etc/openhab2/scripts while openhab2 is up and running fine and it was loaded properly.
When changing the rule file back so it is called I get the following error:

==> /var/log/openhab2/openhab.log <==
2019-08-29 07:18:33.740 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Error during the execution of startup rule 'Tageszeit berechnen': null
2019-08-29 07:18:33.886 [ERROR] [xbase.resource.BatchLinkableResource] - resolution of uriFragment '|::' failed.
org.eclipse.xtext.util.RuntimeIOException: /var/lib/openhab2/zeit.rules (No such file or directory)

That looks like a big clue. Sorry I do not have OH2.5 to confirm.

That’s obviously wrong folder, I’m guessing that is the correct filename for the rule that calls the script. Like the script return messing up.
It’s quite possible that not many people use scripts to expose a bug here.

I suggest if this is repeatable you create a simple example and a github issue.