RM4: Cannot invoke method tokenize() on null object

When editing a rule today, I managed to run into this error twice, and can then no longer edit the rule(s) and have to recreate it from scratch.

So I think I know roughly how reproduce it...but it takes a bit of poking around. Each time I was looking for a particular action and where it would be hidden, so it involved going through nearly all possible actions.

Problem:

  1. RM4 new rule, set a trigger on Switch Change. (don't think it maters)

  2. Edit the action of the rule.

  3. Insert a new action.

  4. Poke around through the possible action types. Select an action category, and perhaps even select an action. Then go back and change the category. After doing this for 3-4 mins going through various options I get a dialog saying there's been a the above failure.

  5. From then on you can no longer edit the rule and must delete the rule and re-add it from scratch.

In the logs this is logged:

[app:483](http://hubitat.local/logs/past#app483)2019-09-07 05:49:47.063 pm [error](http://hubitat.local/installedapp/configure/483)java.lang.NullPointerException: Cannot invoke method tokenize() on null object on line 2214 (selectActions)

Misc info: FW installed is current. Web browser is mobile safari.

So a few screen shots if it helps:

Error:

Rule I was editing the first time it happened, I was adding the "if time between block" and adding an action into the empty if statement.

Example of the logs:

You have an If statement followed by an END-IF. Why? If you're not going to do anything, why bother checking the condition? I think that might be your problem. It's a malformed rule.

image

Because when adding the body the RM decided to corrupt the rule. When I rebuilt the rule it was linearly, and it corrupted the rule exactly the same way when inserting a new action and going through and changing action categories.

So 2 points:

  1. Same error occurred regardless of the empty if

  2. An empty body on an if while unusual isn't a reason to corrupt a rule, and if were an issue would also be a bug. (Many worse things happen when editing rules)

Can you reproduce this failure? Do you know the steps to cause it? I've seen this before, and would really like to track down what is happening.

@bravenel Yes I totally can, takes ~2 mins.

It corrupts in step 4 of my instructions. But it's not: click rule category "Conditionals Actions", then change to "Delay or Repeat action Wait" and crash. Rather it's switch around for a while and then bam

I have a video screen capture reproducing the bug. It's 2 mins 15s long showing me reproducing the bug. I can't attach a video to the forum, how would you like me to get it to you?

I'm having this same error with the button controller after I deleted a device and it broke the rules for the buttons and need to fix them.
I had to delete the button controller and recreate the rules.

Same error happened to me the first two rules I have ever created so not a great start with rule machine, yes I likely created a bad condition but I am learning. I am disappointed I have to delete the entire action and start over because of this error. I will surly not be moving my more complicated processes over from webcore until rule machine is usable and more forgiving when bad conditions are created.