If you hit the central switch in Jungle Japes during a cutscene, Diddy's cage won't open up and you will have to exit and reenter the level to free him. This mostly happens because of the bad hit detection. If you miss the central switch, shoot the left switch, notice that you missed the other one and shoot it again, you will hit the central switch during a cutscene and get the switch glitch.

If the central switch won't register, try shooting at it after the cutscene of the left switch in order to avoid this annoying glitch.