Unexplainable error while simulating

Hello, Back again.

Firstly, I dont know the extent of how much help I can ask and get from this forum. Are there any rules or restriction? So if I’m really asking a lot then my apologies.
I have the following code, which upon certain condition will call disarm(). This function receives state.token from a login(). Everything executes well untill at the end of execution I get the following message. I tried my friend google, but could not get an explanatory answer. Also bellow is the console out put which basically tells me everything was executed accordingly. Any help ?

groovy.lang.MissingMethodException: No signature of method: groovy.util.slurpersupport.NodeChildren.isArray() is applicable for argument types: () values: []
Possible solutions: isEmpty(), every()


def disarm() {
log.debug "During disarming. ${state.token}"
if(state.token) {

        def paramsDisarm = [
			uri: "URL",
			body: [SessionID: state.token, LocationID: 395502, DeviceID: 509622, UserCode: '-1']
			]
			httpPost(paramsDisarm) { responseDisarm ->
            log.debug "Code is ${responseDisarm.data.ResultCode}"
            log.debug "Message: ${responseDisarm.data.ResultData}"  
            sendPush("Home is now Disarmed")
    		}
 	   log.debug "Is this getting executed"
       logout()
	}
    else
    {
    log.debug "Smart Things is not logged in. Need to login"
   		login()
        disarm()
    }

}

def logout() {
log.debug "During logout - ${state.token}"
def paramsLogout = [
uri: “URL”,
body: [SessionID: state.token]
]
httpPost(paramsLogout) { responseLogout ->
log.debug “Smart Things has successfully logged out”
}
}


Console output

8:58:41 PM: error groovy.lang.MissingMethodException: No signature of method: groovy.util.slurpersupport.NodeChildren.isArray() is applicable for argument types: () values: []
Possible solutions: isEmpty(), every()
8:58:41 PM: debug Smart Things has successfully logged out
8:58:40 PM: debug During logout - 65103122-1915-49C2-A021-015871AD7C93
8:58:40 PM: debug Is this getting executed
8:58:40 PM: debug Message: Session Initiated. Poll for command state update
8:58:40 PM: debug Code is 4500
8:58:36 PM: debug During disarming. 65103122-1915-49C2-A021-015871AD7C93
8:58:36 PM: debug Smart Things has logged In. SessionID: '65103122-1915-49C2-A021-015871AD7C93’
8:58:32 PM: debug Smart Things is not logged in. Need to login
8:58:32 PM: debug During disarming. null
8:58:32 PM: debug Mode is set to Home, Performing Disarm
8:58:23 PM: trace TotalConnect was provided…creating subscription
8:58:23 PM: trace Home was provided…creating subscription
8:58:23 PM: trace TotalConnect is attempting to unsubscribe from all events

I should add, the error is only noticed when I use Map “state.token” and then call it during different functions. …

If define the token as variable and return it after the function, then it works without error. but I’m not able to call runIn(10, somehandler(withArguements))

which was the reason for using method “state”

Would be awesome if some one can help me to get a full stacktrace, if thats possible