During a battle, I had a substitute up with Kyurem. (Pokemon probably doesn't matter but I am giving information)
The opponents Rotom used volt switch, and then switched out to another pokemon, breaking my substitute as it did.
I was slower than the rotom, so I used substitute to recreate my sub once it broke.
It told me that the move failed, and did not create a substitute.
The next turn, I was able to create one without issues.
This also happened once more with the move Knock Off from my opponents Landorus-T.
From my understanding, it seems that the substitute move checks if you already have a substitute at the beginning of the turn, rather than if you have one when your pokemon uses the move. Hopefully this is a simple fix, just moving an if statement. If not, please feel free to ask for any other information.