Error: Cannot invoke method tokenize() on null object

@bravenel I've run in to an issue in Rule Machine 3.0 running 2.0.9.133

I was creating this new Triggered Rule:

I was in the "Select Actions for True" window and had just added the switches per mode action. I was clicking through the "Select Action Type to set" dropdown list trying to find which action type to select to be able to run a RM action when I got this error message:

image

It threw me back to the "Define a Triggered Rule" window with the first action saved. Every time I try to go in to the "Select Actions for True" now I get the same error message.

The logs do not add much to the error message:

I get a similar error when trying to go in to "Select Actions for False": java.lang.NullPointerException: Cannot invoke method tokenize() on null object (selectActionsFalse)

I have created a new rule with the same settings but I was unable to reproduce the error there. I've still got the failing rule if you want to have a look at it

I'll look into it. Thanks.

Can you show me the app status for the broken rule? Gear icon.

Settings

Name Type Value

actSubTypeTrue.1 enum Set these switches per mode
actTypeTrue.1 enum Control Switches, Capture or Restore
actTypeTrue.2 enum Set Dimmers
cond enum Illuminance of Sensor - Master Bedroom is > 20
isDev1 bool false
origLabel text Master Bedroom Faulty - Motion Detection
rCapab1 enum Illuminance
rCapab2 enum Motion
rDev1 capability.illuminanceMeasurement Sensor - Master Bedroom
rDev2 capability.motionSensor Sensor - Master Bedroom
RelrDev1 enum >
state1 number 20
state2 enum active
switchModesTrue.1 enum ["1","2","65","34","33"]
switchMTrue.1 capability.switch Virtual Switch - Master Bedroom Lights State
switchTrue.11 enum on
switchTrue.12 enum on
switchTrue.133 enum on
switchTrue.134 enum on
switchTrue.165 enum on
tCapab1 enum Motion
tDev1 capability.motionSensor Sensor - Master Bedroom
tstate1 enum active
Event Subscriptions

Source Event Handler Filter

Sensor - Master Bedroom motion.active allHandler true
Application State

Name Value

actCondNdx -1
actionDone true
actionListTrue [1]
actionsTrue {1={wait=, modes={}, method=getModeSwitch, cond=0}}
actLabelIndent
actNdx 2
cancelList []
cancelListPend []
capabActDone false
capabDone true
capabsfalse {2.false=Sensor - Master Bedroom active, 1.false=Illuminance of Sensor - Master Bedroom is > 20, 3.false={}}
capabstrue {1.true=Sensor - Master Bedroom active, 2.true={}}
certainTimes []
condOper oper
convertedFromRule true
cstCmds [{334_1=[setVolume(40), musicPlayer]}, {324_1=[refresh(), switch]}, {335_1=[setVolume(50), musicPlayer]}, {282_1=[setVolume(85), musicPlayer]}, {280_1=[setVolume(75), musicPlayer]}, {165_1=[on1(), switch]}, {326_2=[configure(120,1), switch]}, {169_1=[off1(), switch]}, {175_1=[on2(), switch]}, {176_1=[off2(), switch]}, {326_1=[updateSingleParam(120,1), switch]}, {428_1=[arrived(), presenceSensor]}, {429_1=[departed(), presenceSensor]}]
editCondIf
eval [2, AND, 1]
firstR true
globVars
hasAll false
hasCondition false
hasDevice null() on null
hasElse false
howMany 3
howManyT 14
inIf false
inRepeat false
installedCapabs [Polling, PowerMeter, PushableButton, IlluminanceMeasurement, ReleasableButton, Battery, Outlet, MotionSensor, AudioVolume, SpeechSynthesis, ColorTemperature, PresenceSensor, Light, Refresh, EnergyMeter, RelaySwitch, MusicPlayer, ColorMode, TemperatureMeasurement, HoldableButton, SwitchLevel, Switch, ChangeLevel, Configuration, Actuator, ColorControl, Sensor, VoltageMeasurement]
isExpert true
lastCodes {}
lastEvtDate 05/11/2019
lastEvtName Sensor - Master Bedroom
lastEvtTime 10:49
lastEvtValue active
ndx.false 3
ndx.true 2
paramNdx 1
paramsDone false
parenLev 0
parens 0
paused true
private true
repeating {}
ruleType tule
skipIfActionsTrue false
skipRepeatActionsTrue false
subscribedVariables []
success true
token 3
varUseList {}
wasEndSR false
wasRepeating {}
Scheduled Jobs

No Scheduled Jobs are set.

Did you edit those actions before or after adding the Switch per mode? Was there some other action there that was deleted? Like maybe a Custom Action?

I was creating the Triggered rule as it's displayed in the screenshot above, from top to bottom in one go. I had just added the first action for true (the switches per mode) and went on to add a second action. I was clicking through the action type dropdowns to see what options there were in the actions dropdown for each type when it threw me out, but I didn't add another action

OK, thanks for the clarification.

I've managed to reproduce it once now. I'm currently documenting every step I'm doing trying to reproduce it again

While I was able to reproduce it once, I don't remember exactly what I did to trigger the issue. I have tried over 90 different combinations now, while documenting it, but haven't been able to reproduce.

The steps I know I did when I was able to reproduce it were:

  1. Create new Rule
  2. Set the conditions and define rule
  3. Convert to triggered rule
  4. Set the trigger event
  5. Set the switches per mode as actions for true (don't click "Done with actions for true")
  6. Select an action type from the dropdown list
  7. Select an action from the dropdown list, without adding this action
  8. Repeat 6-7 with different action types and actions until it errors

I'm pretty sure I was somewhere in the bottom 4 action types ("Set Private Boolean, Run/Stop", "Run Custom Action or Custom command", "Delay or Repeat Actions" or "Conditional Actions") when the issue last occurred, but I was unable to reproduce that later.

ah ha, so there was more going on. The thing is, the application state you showed revealed that Custom Action had been selected. And, I found a problem with selecting Custom Action but not completing it. That is most likely what threw the error, although I'm not able to get it happen either. A fix for this has been done, and will be in the next release.

1 Like

Sorry about the wild goose chase but it did lead to a bug being found at least. Hopefully it was also that bug that caused my issue. Thank you!

Same error here. Did this get released?

You need to show the error, and the rule that caused it.

Goodbye! RuleBuilt In App

Settings

Name Type Value

actSubTypeMain.1 enum Set Mode
actSubTypeMain.10 enum Wait for Events
actSubTypeMain.11 enum Arm/Disarm Hubitat® Safety Monitor
actSubTypeMain.12 enum END-IF
actSubTypeMain.13 enum Wait for Events
actSubTypeMain.14 enum Send or Speak a Message
actSubTypeMain.16 enum Close garage door
actSubTypeMain.3 enum Turn switches off
actSubTypeMain.4 enum Send HTTP Get
actSubTypeMain.6 enum Run Custom Action
actSubTypeMain.7 enum IF (conditions) THEN
actSubTypeMain.8 enum Arm/Disarm Hubitat® Safety Monitor
actSubTypeMain.9 enum ELSE
actTypeMain.1 enum Set Mode or Global Variables, Run Custom Action
actTypeMain.10 enum Delay or Repeat Actions, Wait
actTypeMain.11 enum Control HSM, Garage Doors, Locks or Valves
actTypeMain.12 enum Conditional Actions
actTypeMain.13 enum Delay or Repeat Actions, Wait
actTypeMain.14 enum Send or Speak a Message, Send HTTP Request
actTypeMain.16 enum Control HSM, Garage Doors, Locks or Valves
actTypeMain.17 enum Set Mode or Variables, Run Custom Action
actTypeMain.3 enum Control Switches, Push Buttons
actTypeMain.4 enum Send or Speak a Message, Send HTTP Request
actTypeMain.6 enum Set Mode or Global Variables, Run Custom Action
actTypeMain.8 enum Control HSM, Garage Doors, Locks or Valves
actTypeMain.9 enum Conditional Actions
alarmMain.11 enum armAway
alarmMain.8 enum armAway
cCmdMain.6 enum setAway
garageCloseMain.15 capability.garageDoorControl Garage Door
garageCloseMain.16 capability.garageDoorControl Garage Door
garageCloseMain.2 capability.garageDoorControl Garage Door
httperMain.4 text http://192.168.1.138:3000/Routine/Goodbye
insertAct enum 7
modeMain.1 enum 4
msgMain.14 textarea Your home is now in Armed Away status.
myCapabMain.6 enum Thermostat
noteMain.14 capability.notification Pushover HSM Confirmation
offSwitchMain.3 capability.switch Island Lights, Backyard Light, Mud Room Lights, Dining Room Light, Kitchen Recessed Lights, Nook Lights, Deck Light, Mantle Lights, Fireplace, Living Room Lamps, Foyer Lamp, Playroom Lamps, Powder Room Lights, Playroom Motion Sensor, Playroom Desk Light, Foyer Hallway Lights, Arley's Night Light, Arley's White Noise, Kids Bathroom Light, Jackson's Bedroom Light, Arley's Motion Sensor, Master Bath Vanity Lights, Master Bath Tub Lights, Master Bath Toilet Light, Office Desk Lamp, Office Lamp, Master White Noise, Arley's Light, Master Left Light, Master Right Light, Mud Room Strip Lights, Garage Light, Driveway Light, Office Motion Sensor, Master Closet Light, Chandelier, Master Bath Lights
origLabel text Goodbye! Rule
rCapab1 enum Switch
rCapab2 enum Garage door
rDev1 capability Goodbye!
rDev2 capability.garageDoorControl Garage Door
state1 string on
state2 enum closed
tCapab-2 enum Garage door
tCapab-3 enum HSM Status
tCapab1 enum Switch
tDev-2 capability.garageDoorControl Garage Door
tDev1 capability.switch Goodbye!
thermoMain.17 capability.thermostat Thermostat
tstate-2 enum closed
tstate-3 enum armedAway
tstate1 enum on
Event Subscriptions

Source Event Handler Filter

Goodbye! switch.on allHandler true
Application State

Name Value

actionCancel false
actionDone true
actionListMain [1, 3, 4, 6, 7, 8, 9, 16, 10, 11, 12, 13, 14]
actionsMain {11={wait=null, delay=, modes={}, method=getSetHSM, rule=0, cond=0}, 12={wait=null, delay=, modes={}, method=getEndIf, rule=0, cond=0}, 13={wait=[3], delay=, modes={}, method=getWaitEvents, rule=0, cond=0}, 14={wait=null, delay=, modes={}, method=getMsg, rule=0, cond=0}, 16={wait=null, delay=, modes={}, method=getCloseGarage, rule=0, cond=0}, 1={wait=null, delay=, modes={}, method=getSetMode, rule=0, cond=0}, 3={wait=null, delay=, modes={}, method=getOffSwitch, rule=0, cond=0}, 4={wait=null, delay=, modes={}, method=getHTTPGet, rule=0, cond=0}, 6={wait=null, delay=, modes={}, method=getDefinedAction, rule=0, cond=0}, 7={wait=null, delay=, modes={}, method=getIfThen, rule=2, cond=0}, 8={wait=null, delay=, modes={}, method=getSetHSM, rule=0, cond=0}, 9={wait=null, delay=, modes={}, method=getElse, rule=0, cond=0}, 10={wait=[2], delay=, modes={}, method=getWaitEvents, rule=0, cond=0}}
actLabelIndent
actNdx 17
allVars {}
allVarsO []
blockIfMain false
capabActDone false
capabDone true
capabsfalse {2.false=Garage Door closed, 1.false=Goodbye!(off) turns on}
capabstrue {1.true=Goodbye!(off) turns on, -3.true={}, 2.true={}, -2.true={}}
certainTimes []
condOper cond
doneWaitEvents false
editCondIf
editingRule false
eval {2=[2]}
firstR {2=false}
globVars {}
gvList []
hasAll false
hasCompleteRule false
hasCondition false
hasDevice Thermostats: [Thermostat]:
hasElse false
hasRule false
hasRuleAct false
hasWaitEvent false
hasWaits false
howMany 2
howManyT 2
inIf false
inRepeat false
inRepIf false
installed true
installedCapabs [ColorMode, Polling, IlluminanceMeasurement, CarbonMonoxideDetector, HealthCheck, Battery, Outlet, DoorControl, MotionSensor, Alarm, SpeechSynthesis, Initialize, ColorTemperature, PresenceSensor, SmokeDetector, Thermostat, Light, AccelerationSensor, Refresh, RelativeHumidityMeasurement, AudioVolume, ThreeAxis, TamperAlert, RelaySwitch, MusicPlayer, UltravioletIndex, TemperatureMeasurement, Momentary, GarageDoorControl, Notification, SwitchLevel, WaterSensor, Tone, Switch, ChangeLevel, Configuration, SleepSensor, PressureMeasurement, Actuator, Sensor, ContactSensor, ColorControl, PowerSource]
lastCodes {}
lastEvtDate 19-Oct-2019
lastEvtDevId 36
lastEvtName Goodbye!
lastEvtTime 09:24 AM
lastEvtValue on
locationBlocked []
lvList []
moreVar false
ndx.false 6
ndx.true 2
nestedBlockMain []
nestedIfMain []
nestedInIf []
nestedLabel []
nestedRepIf []
nestedSkipAllMain []
paramNdx 1
paramsDone false
parens {2=0}
prevState {36=off, HSM=armedAway, 139=open}
private true
repeating []
ruleNdx 3
selectActionsParams {thisStr=Main, label=Goodbye! Rule}
simpleCond false
skipAllMain false
skippingMain false
skipTypeMain else
subscribedVariables []
token 1
trigCustoms []
varUseList {}
waitAttr hsmStatus
waitB {}
waitBL {}
waitBV {}
waitCondNdx 4
waitConds []
waitDone {Main.10={2=true}, Main.13={3=true}}
waitEvent
waitEvents [Main.12.-3]
waitMethod allHandlerW
waitNdx {Main.10=[2], Main.13=[3]}
wasEndSR false
Scheduled Jobs

No Scheduled Jobs are set.

Do you see the Broken Action in your rule? That's the cause. You need to fix that. That came from some improper input while setting up the action. You have to delete that action, and put in whatever action belongs there. You could start by trying to Edit Action for that, and that might give you a clue for what it was supposed to be.

Exactly, but when I click into the Action sections, Hubitat throws error so I can't delete the broken action. There is no way for me to get inside the rule to remove the broken action.

Then you will have to delete the rule and re-create it.

It would be nice to make this error proof, meaning to at least be able to delete the broken action and make a small adjustment vs recreating the rule altogether.