Was also experiencing this on Alfred v4. I was also seeing system commands like "Lock" not work.
Turns out I just needed to grant Alfred "macOS Accessibility" permissions via Alfred Preferences > General > Request Permissions and follow the instructions for Accessibility.