Weird bug with spotlight?

I was setting up a flashlight for my horror game project, however, there is some weird bug:

This only happens if I use a cookie for the spotlight, if there’s no cookie, everything works fine. Why does this happen?

In the texture of the light cookie, make sure Wrap Mode is set to Clamp.