The error message usually makes it easy to identify which application has locked secure input. If Alfred reports that "loginwindow seems to be preventing text expansion by locking secure input" or a random process number, it's likely that Alfred is unable to tell which application is using secure input.
This can be because macOS itself has left the secure input enabled (e.g. when you've recently logged into your Mac, or after waking your computer and typing your password). This can be resolved by restarting your Mac, or logging out fully and logging back in.
If the issue occurs frequently, try launching a minimum number of apps/services on your Mac, and re-launching apps one by one, allowing you to establish which app or service is locking secure input by process of elimination. Note that browser plugins (e.g. password managers) can be the cause, so enable plugins one at a time to test them.