I had this problem yesterday for the first time streaming "Rise of the Tomb Raider".
With other games like Cs-GO, Fortnite, Apex never happened.
I use "NVENC new" for encoding, Nvidia Driver version 436.48, and I run the last OBS 24.0.3 always as administrator on Win 10 to avoid the lag problem about games like Apex.
The error happened 3 times, the first after about 50 minutes of streaming, the second more than 4 hours after the first one, and the third after another 45 minutes from the second one. Playing always the same game "Rise of the Tomb Raider".
I don't have COD Modern Warfare to try, but seems that it's not the only game where the Encoding Error happens on OBS.