It was probably not properly cured and stored in an airtight container while still a little bit Damp.There are organisms that function in the lack of oxygen and these organisms attack the chlorophyll and terpenes,eat the plant sugars and
Produce Ammonia as a waste Product.Leaving a Musty Ammonia Like Odor on the Herb.

I Read This in an Article By Ed Rosenthal.