I run into a case from time to time when I’m developing new automations where they end up hanging and stop responding. Since most of my automations are set to only allow one to run, this ends up causing future calls to it to fail since the hung iteration is still out there.
This is a small template you can use to figure out what automations are currently running in home assistant. This looks for any automations with the “current” attribute, which signifies that an instance of it is running. This creates a list of those and outputs it, and can be used from the template tab of the developer tools or turned into a card on the dashboard (through using the markdown card or similar).
{{ states.automation
| selectattr('attributes.current', 'defined')
| selectattr('attributes.current', '>', 0)
| map(attribute='name') | join('\n') }}
If you know an automation is stuck and not going to complete for some reason or another, there is a way to stop it. Simply disable the automation. When disabled, home assistant will kill any running instances of it. You can then re-enable it to keep working on the automation development or to simply let it start running again (in case it was stuck due to other factors).
We can also put this in a markdown card and show it on our dashboard to see if any automations are stuck. My demo automation just has a wait action for 10 minutes.