OH 4.2 SNAPSHOT - Disabled Rules Failed to compile error in opehab.log

Hi All

I am running the latest 4.2.0.SNAPSHOT (Build #4197) and have noticed that when I start openHAB I get errors as follows in my openhab.log:

2024-07-24 12:10:41.961 [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to compile rule ‘ZZ_Partition3_State_Changed' with status 'UNINITIALIZED'

The rule is however disabled:

This seems to be a new occurrence since upgrading to 4.2.0, but I am not 100% sure.

Is it expected behavior for a disabled rule to generate an error on startup? Doesn’t seem to break anything, but not nice when there are a few disabled rules.

Thanks
Mark

@florian-h05 , could this be related to the precompile PR?

Seems to be related.

@Mark_VG Can you please share the code tab (copy it in a code fence) of the rule?

Sure, no problem.

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: Partition3_PartitionState
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      blockSource: '<xml
        xmlns="https://developers.google.com/blockly/xml"><variables><variable
        id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</variable><variable
        id="O(o/:^9(;ZLR4]XMDj9]">partition3PreviousState</variable></variables><block
        type="variables_set" id="`C#0Z0yp,gi?NJUu#aE8" x="9" y="151"><field
        name="VAR" id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</field><value
        name="VALUE"><block type="oh_context_info"
        id="G2U82v]_5a/:J4B_f:AP"><field
        name="contextInfo">itemState</field></block></value><next><block
        type="variables_set" id="Q|m#{c_Jej}cja1IYsgb"><field name="VAR"
        id="O(o/:^9(;ZLR4]XMDj9]">partition3PreviousState</field><value
        name="VALUE"><block type="oh_context_info"
        id="]FNCCD5].{/Gi0_r;yS}"><field
        name="contextInfo">oldItemState</field></block></value><next><block
        type="text_append" id="[}4p.*3G^%RAz3KU{scA" disabled="true"><field
        name="VAR" id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</field><value
        name="TEXT"><shadow type="text" id="1Elxp0O7(3$KNR=RHqwv"><field
        name="TEXT"></field></shadow></value><next><block type="text_append"
        id="zkD)Nv`0;P||jX87Bf@|" disabled="true"><field name="VAR"
        id="O(o/:^9(;ZLR4]XMDj9]">partition3PreviousState</field><value
        name="TEXT"><shadow type="text" id="=Ww3^`3v?718!u6L6.gz"><field
        name="TEXT"></field></shadow></value><next><block type="oh_log"
        id="lqFfQ|J[3BtM`N$*GuJN"><field name="severity">debug</field><value
        name="message"><shadow type="text" id="[z|X7AVQAh[]7rZ7K]j("><field
        name="TEXT">abc</field></shadow><block type="text_join"
        id=",igz127YU/9xw7%A9F9)"><mutation items="2"></mutation><value
        name="ADD0"><block type="text" id=",OV%5Kk5IENT}}-Sb-Pq"><field
        name="TEXT">New State is: - </field></block></value><value
        name="ADD1"><block type="variables_get" id="oDpfqY92z}dP}f-]+p(_"><field
        name="VAR"
        id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</field></block></value></block></value><next><block
        type="oh_log" id="lH?,lY44G(JdFr8Qg4s2"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="[z|X7AVQAh[]7rZ7K]j("><field name="TEXT">abc</field></shadow><block
        type="text_join" id="qqdn+[d^sPh16QyQmml$"><mutation
        items="2"></mutation><value name="ADD0"><block type="text"
        id="I=qYFc~%@tvmFbR6(/jr"><field name="TEXT">Previous State was: -
        </field></block></value><value name="ADD1"><block type="variables_get"
        id="+mnvuBq?IZ^ShVCV+J(Z"><field name="VAR"
        id="O(o/:^9(;ZLR4]XMDj9]">partition3PreviousState</field></block></value></block></value><next><block
        type="controls_if" id="$/9FR8lE~Vrf$4d=1LMs"><value name="IF0"><block
        type="logic_compare" id="%,=bmcSb6sy|BJ4Ez{4D"><field
        name="OP">EQ</field><value name="A"><block type="oh_getitem_state"
        id="bM9w]+5=6RV]6tH@+;;L"><value name="itemName"><shadow type="oh_item"
        id="(43L[RbUpn=3.o;XcG|x"><field
        name="itemName">GPSMarkatHome</field></shadow></value></block></value><value
        name="B"><block type="text" id="KsuQ3eeG,OVN5{Uvrlxg"><field
        name="TEXT">OFF</field></block></value></block></value><statement
        name="DO0"><block type="oh_log" id="1w#=.]45CdLzg9TGHh=B"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="t?pO%)z+6ernh#m.AlM)"><field name="TEXT">Partition 3 Changed and
        Mark not Home</field></shadow></value><next><block
        type="oh_sendBroadcastNotification" id="#x/9=yYp@{B,#`xB{r;T"><field
        name="severity">info</field><value name="message"><shadow type="text"
        id="6sE*4ckD=C+Zx]KqZE^6"><field name="TEXT">Partition 3 Changed from
        </field></shadow><block type="text_join"
        id="WzRcvOZnd`J]:+^DI*6L"><mutation items="4"></mutation><value
        name="ADD0"><block type="text" id="~63@zdG6^o;fOKln,+IK"><field
        name="TEXT">Partition 3 Changed from </field></block></value><value
        name="ADD1"><block type="variables_get" id="tYjb1@%m4PVXV;mzL[q?"><field
        name="VAR"
        id="O(o/:^9(;ZLR4]XMDj9]">partition3PreviousState</field></block></value><value
        name="ADD2"><block type="text" id="jKE)0.`/Q:M_[H%w+L|p"><field
        name="TEXT"> to </field></block></value><value name="ADD3"><block
        type="variables_get" id="%YknEtNl!=hStiq=xsDr"><field name="VAR"
        id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</field></block></value></block></value><value
        name="icon"><shadow type="text" id="QXWJGvIq{V~f9rgQ(WFK"><field
        name="TEXT">alarm</field></shadow></value></block></next></block></statement><next><block
        type="oh_log" id="!A8$/#IdTsq#yuX6F_7q"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="8F/s$5Ol^M))R8xZH~QE"><field name="TEXT">Partition 3 Changed
        notification sent!</field></shadow></value><next><block
        type="controls_if" id="**DhF?Q%yJ[*PQW2y-i5"><mutation
        else="1"></mutation><value name="IF0"><block type="logic_compare"
        id="mP1Aj/T*;er,3BRn/I@2"><field name="OP">EQ</field><value
        name="A"><block type="variables_get" id="KkD_2^b[jVlxA^_I~4+l"><field
        name="VAR"
        id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</field></block></value><value
        name="B"><block type="text" id=".P`}M/JBI[sJBzy9TczS"><field
        name="TEXT">Disarmed</field></block></value></block></value><statement
        name="DO0"><block type="oh_event" id=".a!u:-%a/6jTpVf7:x}#"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id="s[)z5+6a3L/P;)P.UrT;"><field
        name="TEXT">OFF</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="X;s0gg`,BtMf55V+ag#s"><field
        name="itemName">Partition3_Armed</field></shadow></value><next><block
        type="oh_log" id="R-MiU{N(a=[G9RFW$i#5"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="$@O@9kA;,PM{ZU~1Nf=_"><field name="TEXT">Partition 3 Armed State
        Updated to
        OFF</field></shadow></value></block></next></block></statement><statement
        name="ELSE"><block type="oh_log" id="g08U$T,,CJ7},k?-d*-$"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="SL;u`-j|D4ijJm9jLNmA"><field name="TEXT">Partition 3 New State
        Disarmed - NOT
        MET</field></shadow></value></block></statement><next><block
        type="controls_if" id="Ovw[TxU].TAIF!xqpH.]"><mutation
        else="1"></mutation><value name="IF0"><block type="logic_compare"
        id="DC+(ts,$/DhlB$[sQOz:"><field name="OP">EQ</field><value
        name="A"><block type="variables_get" id="3mP/T{g#~yb5_J7x!;i@"><field
        name="VAR"
        id="$=MCIGEkdTW*.PPTq^z+">partition3NewState</field></block></value><value
        name="B"><block type="text" id="V1T?a[(*n]?V71%6XwWa"><field
        name="TEXT">Armed</field></block></value></block></value><statement
        name="DO0"><block type="oh_event" id="vKWg+v*P$SZ}~4,YvAa@"><field
        name="eventType">sendCommand</field><value name="value"><shadow
        type="text" id=".YlxYH-8v`rtOwT.auN}"><field
        name="TEXT">ON</field></shadow></value><value name="itemName"><shadow
        type="oh_item" id="!FR|,b]f/W_kXDYu1SEV"><field
        name="itemName">Partition3_Armed</field></shadow></value><next><block
        type="oh_log" id="V+O7;LnWn{W9oq{f:yX-"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="Zuof=KFW?YBHu3$o`akE"><field name="TEXT">Partition 3 Armed State
        Updated to
        ON</field></shadow></value></block></next></block></statement><statement
        name="ELSE"><block type="oh_log" id="1W$`h*vo`MRo|VaeU-vu"><field
        name="severity">debug</field><value name="message"><shadow type="text"
        id="9s[4oJ82=j!(0mC~Wt=q"><field name="TEXT">Partition 3 New State Armed
        - NOT
        MET</field></shadow></value></block></statement></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></xml>'
      type: application/javascript
      script: >
        var partition3NewState, partition3PreviousState;



        partition3NewState = event.itemState;

        partition3PreviousState = event.oldItemState;

        console.debug(('New State is: - ' + String(partition3NewState)));

        console.debug(('Previous State was: - ' +
        String(partition3PreviousState)));

        if (items.getItem('GPSMarkatHome').state == 'OFF') {
          console.debug('Partition 3 Changed and Mark not Home');
          actions.NotificationAction.sendBroadcastNotification((['Partition 3 Changed from ',partition3PreviousState,' to ',partition3NewState].join('')), 'alarm', 'info');
        }

        console.debug('Partition 3 Changed notification sent!');

        if (partition3NewState == 'Disarmed') {
          items.getItem('Partition3_Armed').sendCommand('OFF');
          console.debug('Partition 3 Armed State Updated to OFF');
        } else {
          console.debug('Partition 3 New State Disarmed - NOT MET');
        }

        if (partition3NewState == 'Armed') {
          items.getItem('Partition3_Armed').sendCommand('ON');
          console.debug('Partition 3 Armed State Updated to ON');
        } else {
          console.debug('Partition 3 New State Armed - NOT MET');
        }
    type: script.ScriptAction

I have quite a few rules that are disabled generating the error.

Thanks
Mark

Thanks for the code.
I found the issue, should be easy to fix - and whilst having a look, I probably found another bug, I will check that and then create a PR.

2 Likes