Don’t think your post has all the info needed. The code you posted looks OK, however, it is unclear how you have defined alarmStatus and ALARM_DEACTIVATED
Does the rule contain more statements, maybe it is connected to another line.
What can help quite a bit is adding more loginfo statements to make sure that all items, variables, etc contain the value that you expect them.
For items you can convert the state into string like so: MyItem.state.toString
It is not related with other parts of code and variable definition - it worked before adding return. But as was commented by gitMiguel there was a problem with semicolon.
I suggest to mark your topics solved if somebody provides a solution and you get it working. Afterwards when other users are searching through the forum and trying to find answers it’s easier to pick the ones that has been already solved.
Does your rule require the return statement? Or does the rule work even when you have it in place? Can you post your whole rule so we can see if it’s possible to write it without return statement.
Rule is quite long and makes many thing that are not important when we talk about this bug but I’ve changed to “return;” to “return false” and now there is no error. From Exit rule with return false I know that “return;” was introduced but it is available in RC not in stable version. So far “return false” is ok for me.