When calling RRSetMonitor, an existing monitor name is allowed. "If 'name' matches an existing Monitor on the screen, the existing one will be deleted as if RRDeleteMonitor were called." https://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt
It looks like the check was added by mistake, because in the next 'for' the monitor is deleted if it is in this list.
Steps to reproduce: Try RRSetMonitor with existing monitor name and other valid params OBSERVED RESULT: RRSetMonitors returns BadValue EXPECTED RESULT: RRSetMonitors returns OK