sometimes when driving the check engine light comes on then goes back off? on 2001 Pontiac Sunfire

it occurs about every other day for the last week it comes on for hours and then some times for only 15-30 min what could it be?

Asked by for the 2001 Pontiac Sunfire