errorjava.lang.NullPointerException?

app:652020-03-28 12:37:11.107 pm errorjava.lang.NullPointerException: Cannot invoke method tokenize() on null object on line 2547 (selectActions)

app:652020-03-28 12:37:03.276 pm errorjava.lang.NullPointerException: Cannot invoke method tokenize() on null object on line 2547 (selectActions)

I was editing a rule. I was adding a new condition before the first one. I selected "Conditional" and then bang got an exception. I looked at the log. I have the line posted.

Now, anytime I come back to that rule, it crashes. I'll have to delete the whole rule and start again. Very frustrating ... Any way to fix that without re-writing everything?

Step 1:
Click the "Action to run"

Step 2:
Crash

Correct.

I'm not sure you'd like to edit it and then forevermore, wonder if it's correct. Having past the zillion times mark of having done this... my current technique is to pick up my iPad and take a pic. Delete then start over. (Eventually deleting the iPad pic.)

Also, document, as you did, what led to the error and tag support or @bravenel That way it's at least potentially, a future improvement.

Thank you for confirming :slight_smile: I am also at the moment opening two tabs of my browser to rebuild the rule :thinking: :face_with_raised_eyebrow:

I have been using the system for just about 2 weeks and I'm not sure of the direction of the product. It is well known in the industry to have source control when writing code. A rule is a snippet of code. It should be versioned per rule and have the user the possibility to rollback. Not very hard to do as well: create a new entry in the database each "Done" of a rule. Oh well :slight_smile: Hopefully, the root of that issue will be fixed someday.

Thanks for your reply csteele

That will not work and will likely corrupt the rule. You can only open a rule in one window at a time. You also must click done and not use your back button or move to another window with any other hyperlink until you get back to the full list of all of the apps.

These are rules, not code. To implement something like you are asking would be extremely labor intensive. If you follow the instructions for using it, you won't run into a problem. Remember, the system is designed to work for normal folks, not just programmers.

I like that idea. As I've said, I've corrupted my fair share of Rules, so my fingers are more or less on autopilot to delete ANY in which the Edit didn't function as I expected it to. Have you considered Cloning the Rule prior to editing then Disabling it?

One page I do not touch, and one I edit. How can it corrupts the rule?

If you hit done in the one you weren't editing, that would corrupt the rule.

Look....obviously you did something to corrupt the rule, right? Can we agree that it didn't happen on it's own?

i had a single tab open until it corrupts, now I am copying the rule BECAUSE it was corrupted.

Obviously Hubitat crashes easily, right? We can agree with that with little than few hours of using the product. Software crashes on it's own. A NULL Reference is a code exception that wasn't protected enough and it shouldn't be the customer facing the issue. The code should be more defensive or at least be between try/catch and returns to a stable state.

Can I ask if you used the browser back button at any time while editing/defining the rule.
This is known to corrupt a rule.
Just asking to try and find a cause of the error.

Welcome to HE BTW. Enjoy the ride. :blush:

Humm maybe... that a good angle to check out. I try to avoid, but I could one the rule was "done" moved back to the list of device with back... I'll try to look out to see if it causes it every time or not! Thanks for the pointer :slight_smile:

1 Like

Can't copy a corrupted rule. It will just be corrupted.

I literally said the exact same thing.

Did you just decide to not read the whole comment because you didn't agree with part of it?

Hello,

I have an issue that generate the same error. Here is a description of the issue and an observation that might provide some clues bout its origin.

I have the following simple script that activates or disactivates scenes based on presence.
You can see I am planning to insert a scene activation statement before the first END-IF.

IMG_8516

When I click the menu to select the scene, 2 scenes with identical name are listed. Note that in the Apps/Scene section, only 1 occurrence of Dine/Cook can be seen.

IMG_8517

if I select Dine/Cook and run the script, I get the following error message:

IMG_8518

if I select another scene (like Movie On), the script runs fine.

I do not know what sequence that led to create 2 Dine/Cook scenes in the selection menu. I have rebooted Hubitat, rewrote the script twice from scratch, backup and restore from backup… this issue persists.

Any feedback/suggestions would be greatly appreciated.
Thanks