[SOLVED] JSR223 Javascript: stopped working because of evaluation error


everything was fine for months then I restarted openHAB and my javascript rules stopped working.

The error in the log

Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/jslib/triggersAndConditions.js': ReferenceError: "TriggerHandlerFactory" is not defined in <eval> at line number 12

Anyone an idea?
@lewie: Something you can explain?

Thanks in advance!

Post the rule please.

Hi Harry,

every rule stopped working, so it is nut rule specific.

The following rule is an example:

	name: "Music Mode",
	description: "",
	triggers: [ 
		//IS WORKING: TimerTrigger("0/15 * * * * ?")
		//IS WORKING: ChangedEventTrigger("testItemSwitch", "ON", "OFF")
		//IS WORKING: UpdatedEventTrigger("testItemSwitch"),
        //IS WORKING: CommandEventTrigger("testItemSwitch")
	execute: function( module, input){

        logInfo("MusicMode", "MusicMode Switched");
        var receivedCommand = getTriggeredData(input).receivedCommand;
        var Box_Kitchen_Mode = getItem("Box_Kitchen_Mode");

        logInfo("MusicMode", "MusicMode Activated");
        if (receivedCommand == 2) {
            logInfo("MusicMode", "MusicMode 2a " + Box_Kitchen_Mode.state);
            if (Box_Kitchen_Mode.state != 8) {
                sendCommand("Box_Kitchen_Mode", 8)
            logInfo("MusicMode", "MusicMode 2b " + Box_Kitchen_Mode.state);
        else {
            logInfo("MusicMode", "MusicMode 1a " + Box_Kitchen_Mode.state);
            if (Box_Kitchen_Mode.state != 0) {
                sendCommand("Box_Kitchen_Mode", 0)
            logInfo("MusicMode", "MusicMode 1b " + Box_Kitchen_Mode.state);


The item in the sitemap:

                        visibility=[Scene_Music_1==1, Scene_Music_1==2, Scene_Music_1==3]
			mappings=[1=" 📻 ", 2=" 🌐 "]

The item itself is configured in Paper UI.


1 Like

There is no error in your script. Did you change another script anyhow, which blocks now the others?

I would move all scripts to a backup folder and copy one after the other back to the the rule folder.

I have no idea!

Hi lewie,

no scripts in folder (except jslib) and still the same evaluation error (from above).

I installed some libraries and installed another version of python in parallel. Could that be the problem?


Hi lewie,

me again. :slight_smile:

I followed your advise and move all scripts away and put them into the folder one after another (there are 3 files). After the first file I put in the second file and I got a strange message:

`org.eclipse.smarthome.automation.type.TriggerType with key 'jsr223.StartupTrigger' already exists! Failed to add a second with the same UID!` 

The same with the 3rd file.

The GOOD NEWS: It started working!!!
So my problem is solved.

Thanks again for the hint although I don’t know what was the problem.

1 Like

Hi @lewie,

unfortunately the error appeared again after restart. It helped to refill the directory with the files.

Can I set the log level somehow to get more debug info? Because it is very annoying to do this procedure after each restart…


That sounds like another problem:

For more detailed debug on specific classes use: log:set LEVEL package.subpackage