I had a similar issue years ago. The symptoms on the Jeep were a check engine light and P0481 code being thrown. This code if for the cooling fan. It happened in 95+ degree weather in stop and go traffic with the AC on. The engine temperature did not change.
After lots of reading, I dug into the issue. I started at the TIPM as that seems to be the main source of the issue from what I found. I looked for bad connections or broken wires. None noted. I checked all wires going to the PCM for potential broken wires. None noted. These were the two main issues I found from the reading I did.
I then went to the cooling fan relay (J19), which the location of is not listed in the owners manual. It IS listed on the TIPM cover in the engine bay. In the picture, it is the pink relay with the 30 on it that is in between the yellow and green relay. I checked this for poor connections or corrosion with none noted. Relay was operational.
The last thing I found in my reading made the correlation between the engine fan and the dash compass under the speedometer. On my Jeep, the dash compass was not working. I then went to the fuse for the compass (which is also the AC and few other things). This was fuse M34. This fuse was infact bad. Depsite the fuse being bad, the AC worked fine and no other systems were inoperative other than the Compass. I believe this fuse is linked to the high speed option of the cooling fan as well. I gathered this from reading I did on the issue and one other person that had a similar issue.
Long story short, I replaced the fuse, the compass works and now the engine light does not come on. I've been in stop and go traffic 3 times since with no repeat of the issue. This appears to have remedied the issue. I would never have gone to that fuse as that fuse had no association to the engine fan based on what I read, except for one person that said it did.
Hope this helps!