If you accidentally play all your cards and therefore have nothing to discard, you must recover cards you played during the turn and re-play them in a way that leaves a Loco on every train and one discard.