As noted in the comments, if the controller cannot connect to hivemind initially, but detects hivemind later on in the process when it reaches the if statement in detect(), then it will cause an error. There needs to be just one hivemind connection check and everything should be based on that result.
As noted in the comments, if the controller cannot connect to hivemind initially, but detects hivemind later on in the process when it reaches the if statement in detect(), then it will cause an error. There needs to be just one hivemind connection check and everything should be based on that result.