Season 7 Episode 8 - When Ted learns that the woman he has been looking for every Halloween is not as ideal as he first believed, he gets cognitive dissonance. In his mind, he has created an unrealistic version of her, so when he sees her acting differently from this ideal, his mind gets confused. By pointing out positive aspects of her actions that he had previously overlooked, Ted attempts to rationalize his attraction to her in an effort to lessen his cognitive dissonance, which brings him discomfort.