On the show she leaves because barney did a terrible joke and she got mad about it

But was something happening with Alyson Hannigan on backstage?

The Answer is Pregnancy...

You can tell when Cobie and Alyson are pregnant,

they always shot them from the waist up and they use layers of clothes.

They wrote that joke to explain Lily's absence because Alyson was going on maternity leave.