I just ran into this issue and couldn't find any answers online. In my particular case, it was because I'd written a script to look at specific pixels on screen. I'd forgotten I'd changed my resolution to 1920x1080, so it was trying to view pixels that were outside of the screen (like 3000x2000) and was providing this error. Changing my resolution back to 3840x2160 has resolved the error. I of course could have modified my script as well.