Strings have a shelf life, depending largely on the env't that they're in. They are metal encased in a coating, but we all know what humidity or salt air can do to metal. Granted, we're talking a considerable amount of time here, and under less-than-perfect conditions, so in no way am I suggesting they'll go bad like a gallon of milk left on the counter in summer

While I have never gotten a bad set of Elixirs, I had gotten one bad "G" in a set once ...dead as a doornail from the start. I emailed them and they were kind enough to send me two replacement Gs. Good folks at Elixir!
This is one reason why D'Addario et.al. have gone to plastic wrapping their sets: less packaging, sure, but also
sealed to env't exposure. Perhaps Elixir will go that way one day. Or simply buy strings as you need them.
FWIW, I now keep only one set as a spare (used to keep 2-3), and that one set is relegated to the guitar case and never "rotated in" for use ...so my spare strings (elec and acoustic) are old! ...only good for a string breakage or whatever emergency. Whenever I restring, I have come to now only use a reasonably fresh set. I have no idea if this had made a difference or not, but heck, it's easy enough to do so has become my new habit of late. And yes, I suppose I could try and rotate in my guitar-case backup set so as to keep it all fresh, but that would actually require my remembering something else

Edward