I have this same problem, sometimes. the default path, C:\users\adam\videos is not what I wanted, I made a folder in F called "OBS vids". I went to settings -> output -> and set the Recording path to F:\OBS vids but I got the message. So I tried renaming the folder to OBSvids (thinking spaces were the problem).
I tried switching "Output Mode" to advanced, it changed the recording path back to the default, so I switched it to F:\OBSvids again.
I made sure to set up a hotkey to start recording, switched the game to the foreground and it worked.
I'm not sure what this means. It may imply that when it can't record the foreground window, you get the message. It may have been the issue with spaces in the folder name.