Jeep Transmission sliping

I drive a 98 Jeep Cherokee with a 4 liter straight 6 engine and a 5 speed manual transmission. Sometimes when I’m in 5th gear the transmission starts to slip and the check engine will come on. The light will usually stay on for a few days and it will drive kinda weird until the light goes off and then it drives fine. Any ideas what could be causing this or what I can do to fix it?

There are 2 possibilities, as I see it from afar:

  1. The transmission is not slipping (actually, a manual transmission cannot “slip”), and you really have an engine problem that only manifests itself at high speed. The CEL and the car’s habit of “driving kinda weird” would seem to indicate that this is the case. This also raises the question of when the spark plugs were last replaced, but other maintenance or repair issues could be involved.

  2. Your clutch may be on its way out. While the manual transmission itself cannot slip, the clutch surely can.

My money is on #1, but unless you have the stored trouble codes read, this is all just guess-work.
.