I had the same issue on my truck and it was the vent valve, which is located behind the fuel tank. It cost $20 and is swapped in five minutes.
The evap system is used to prevent gases from fuel from escaping into the environment. Of course, gas must be able to escape, because the air has to come out of the tank when the vehicle is refueled. That's why there is the activated carbon canister and the vent valve, which is open, when the vehicle is switched off.
If I now refuel the vehicle, the air can escape into the environment, through the activated carbon canister.
The vent valve closes when the engine is started, and at the same time the purge valve, which is located at the front of the engine, opens. Then these gases are burned. There is a pressure sensor checking if the system is tight. If the vent valve doesn't close, there is no negative pressure in the system and the message comes: "fuel cap open" because that is the most likely cause.
And because you then have a problem with air leakage at the same time, you have a rough idle