[SOLVED] Getting "Scheduled job '<unknown>' failed and stopped" only on system startup - how can the source be found?

OpenHAB 3.4 on Linux Docker.

During startup I get the following message

2022-12-21 19:36:40.576 [WARN ] [ore.internal.scheduler.SchedulerImpl] - Scheduled job '<unknown>' failed and stopped
jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "event" is not defined
        at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57) ~[jdk.scripting.nashorn:?]
        at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:319) ~[jdk.scripting.nashorn:?]
        at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:291) ~[jdk.scripting.nashorn:?]
        at jdk.nashorn.internal.objects.Global.__noSuchProperty__(Global.java:1616) ~[jdk.scripting.nashorn:?]
        at jdk.nashorn.internal.scripts.Script$Recompilation$132$573$\^eval\_.reportStatus(<eval>:19) ~[?:?]
        at jdk.nashorn.javaadapters.org_eclipse_xtext_xbase_lib_Procedures$Procedure0.apply(Unknown Source) ~[?:?]
        at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$12(SchedulerImpl.java:191) ~[?:?]
        at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$1(SchedulerImpl.java:88) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

As I don’t have a trigger on system startup that i know of. So please can someone help me to identify the rule that causes this exception.

Any help is appreciated.

Thanks a lot.

What we can guess from the error:

  • It’s a Nashorn rule.
  • The rule was triggered either by system started, cron, called from another rule, or triggered manually because event isn’t defined.
  • The rule uses event in some way.
  • Further down in the stack trace we see it calling SchedulerImpl and right above that there’s a Procedure which implies this could be a timer.

That’s about all the clues we can get. Hopefully that’s enough to find the rule in question.

1 Like

Thanks a lot. That pointed me into the right direction. Actually there was a pretty unspecific “member of group changed status” trigger on a group which fired on startup of course because the items get initialized and change later to ON or OFF.
The issue could be easily fixed by changing the trigger to “member of group changed to ON” which prevents the rule to be invoked early because usually the group members are OFF and only switch to ON in case of problems.