Why Does this Barracuda error suddenly pops and stops training - unity ml agents

I have been working on this project for a long time, I want to train a team of agents to simulate a game of basketball (kinda like the soccer example but more complicated because I have tought the agent to shoot and pass separately with different neural networks). I didnt have any problems training the agent to shoot perffectly and pass aswell but when I changed both of the neural nets to inference mode and act like an action in the bigger neural network things started to fail. Everything works well but after training for like a million steps I suddenly get a NullReferenceException from the Unity.Barracuda and then a lot of IndexOutOfRangeException(20 times each frame) (image attached) .Why is this error popping up and stopping my training procces?
image of error - Imgur: The magic of the Internet

My design for this project includes 3 neural networks; the first is assiged to learn shooting, for this learning proccess i have trained it in a different scene over a night and it can shoot perffectly (has continious output) . The same proccess happened with the second neural network, but this one is responisble for passing (has continious output). The third neural network is responsible for the agents movment and decision making- the outputs of this neural network are these (has discrete output):

0 - size = 3 0 - nothing 1 - move forward 2 - move backward
1 - size = 3 0 - nothing 1 - move left 2 - move right
2 - size = 3 0 - nothing 1 - turn left 2 - turn right
3 - size = 2 0 - nothing 1 - jump
4 - size = 4 0 - nothing 1 - shoot 2 - pass to first teamate 3 - pass to second teamate

when this neural net decides to shoot or pass i call a function wich activates the pretrained neural nets of shooting and passing to do the given action.

i must mention that the training proccess goes well untill suddenly without any hint the error pops up and crashes the agent’s script. I think it has to do something with the proccess i mentioned before, because i have never done any thing like this before and never seen any one else use a pretrained neural net as an output action of another neural net.