Depends on the nature of the systems. One would hope that with modern transport category aircraft it happens rarely if at all!
With some of the older Piper light aircraft like the Comanche, retraction is by spring forces pulling the flaps up against air loads. Friction in the system can cause an asymmetric retraction, which is somewhat exciting but usually quite controllable. Re-extending flaps and retracting at lower speed to reduce the air loads seems to do the trick.