The milk flask and the lid have not been cleaned thoroughly enough.
Always rinse the screw thread of the milk flask and the lid thoroughly under running water after cleaning in the dishwasher.
Dry the threads of the milk flask and the lid thoroughly with a dry cloth.