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