Like many sitcoms, How I Met Your Mother is full of continuity errors, but the series has a unique quality that allows it to get away with it. As audiences sat back week after week and listened to future Ted Mosby telling his kids the (very long) story of how he had met their mother, they would notice a few inconsistencies here and there. This is nothing new to sitcoms, where timelines or character details might be shifted for plot convenience. However, the way that How I Met Your Mother set itself up in season 1 made continuity even less of an issue and automatically excused plotholes or inconsistencies.
https://screenrant.com/himym-continuity-errors-ted-memory-faulty-perfect-excuse/