Runs poorly after long drive

I have a 1998 Pontiac Sunfire that after coming off the highway on a long drive (one and a half hours or longer) will idle poorly and hesitate off idle. This is accompanied by the “check engine” light coming on.



Shutting the car completely off and restarting seems to solve the problem entirely and the check engine light will turn off on it’s own shortly after.



Any ideas on what could cause these symptoms?



Thanks!

If the light comes on a code or codes has been set in the computer. Have the code(s)read by a mechanic or a parts store and see what they tell you.

I agree with McP that you should have the code(s)read by a mechanic or a parts store and see what they tell you.

I’m guessing they’ll indicate a malfunction in the IAC (idle air control) unit, but there really is no need to guess.

Thanks for the advice. Another question: Will error codes still show up even after the check engine light goes off?

I considered taking it to Autozone when it happened on Sunday, but after restarting the light went off rather quicky.

The codes should still be there.

I took it to Autozone at lunch and they pulled up code
P0122

Definition: TP (Throttle Position) sensor

Explanation: The throttle position sensor is used for various systems in the vehicle

Possible causes: (1) Sensor open or shorted interanlly- replace component; (2) Check connector and wiring to sensor

The part is about $32. Is this a part that generally requires replacement or is it something that can get gummed up and just needs cleaning?

My problem only crops up after long drives and seems to reset itself after shutting the engine off.

This component is considered not renewable.
Replace it.

Thanks for the help everyone!