Could be several things - the Catalytic converter is prone to fail early, oxygen sensor or you left the gas cap off.
Hopefully you just left the gas cap off.
The computer stores error messages, so the dealership can easily tell you what the error is.