Script not executing when calling it manually

Hi all

I’ve got a script which I created a while ago and which always worked pretty fine. I use it to trigger a bunch of other scripts at the same time. From time to time, it simply doesn’t work, I click on it and it doesn’t fire and it’s not really clear why. I looked at the automation trace to understand what’s going on and I just have the message below:

Is there any way to understand what could be causing this? The script itself is pretty simple and it’s activated manually, so I really have no idea…

The HA log?
Also, please post the automation code. We cannot help you further without knowing the details.

Yeah you’re right. So here we go.
Script code:

alias: Cover Tutto Tapparella
  - service: script.turn_on
        - script.cover_tapparella_camera
        - script.cover_tapparella_camerasofia
        - script.cover_tapparella_cameretta
        - script.cover_tapparella_cucina
        - script.cover_tapparella_soggiorno
        - script.cover_tapparella_bagno
        - script.cover_tapparella_bagnetto
mode: single
icon: mdi:blinds-open

This is the entry in the HA log:

Logger: homeassistant.components.script.cover_tutto_tapparella
Source: helpers/
Integration: Script (documentation, issues)
First occurred: 29 luglio 2021, 8:22:51 (9 occurrences)
Last logged: 8:42:45
Cover Tutto Tapparella: Already running

Don’t know if that is enough, I can provide the full log eventually.

Thanks for helping out!

That’s key. It means your scripts are already running, so a re-execution of them via an automation is denied.
You could change the “mode” of the automation to restart, parallel or queued, but it all depends on what makes sense for the scripts…


Yeah I thought about that, but in reality it should not be running as nothing triggered it… as I said there’s no automation triggering it, so it’s manual. Basically this is what happened:

  • I called the script with a Google Home routine which is set to trigger an entity which was published as a scene in Google Home
  • It didn’t work, so I opened the app and triggered it manually from there

So might it be that the Google Home command failed somehow and triggering it manually from the app failed too because it was “already running”? But even if so, how would it be already running if the Google routine failed to trigger it? I’m confused…

If one of the scripts is in a deadloop, it will be “running” forever (or until next restart), basically…

You might want to change the way you call the scripts too. Have a read of this,

I got your point… it might be one of the called scripts was in such a state, I’ll dig into this, thanks for the hints!

What do you mean exactly? I think when I was setting it up, I tried calling the scripts directly but changed to the script turn on service because the calling script was waiting for the previous called script to end (If I well remember), and that was not what I wanted. I need to call all scripts underneath at the same time. Or perhaps you were referring to something else?

No that’s what I meant. You have considered it, so all good. Calling the script directly will also do this as well though:

If any errors occur that cause the called script to abort, the calling script will be aborted as well.

This may prevent your main script from running indefinitely.

Yeah I just gave up with that configuration due to the inability to run all scripts at the same time (it’s to automate all blinds closing and it’d be pretty “weird” looking at them closing one by one :smiley: ). If you know a way to call them directly all at the same time let me know ! :wink:

Any known reason why the blinds cannot be closed “in parallel”?

Mmm I’m not getting your point. I actually want to close them “in parallel” or “at the same time”, and it’s what I’m doing with the script turn on service. Or did I get your question wrong ?

Sorry, confusion on my side…
But then, the automation is not waiting, so I don’t understand the “Already running”

No worries.
Yeah I do not understand it too. If one of the underneath script would be hanging, the other scripts should then be called normally, unless all of them are hanging (weird!). And could the automation modes can be used with scripts? I would have used an automation to call all scripts, but I guess I’d have the same issue, no way to call them all in parallel…

Any further ideas? This morning it happened again… :frowning: I guess the issue is not in the main script (the one which calls the others at the same time), rather with the scripts underneath. Indeed, I tried to call one of them manually from the Developer page using the script turn on service and nothing happened… Is there a way to troubleshoot why a called script didn’t run ?

Using the “Trace” view is not really helpful as it shows nothing:

Looks like it’s always the same issue:

Is there anything in the other tabs of the trace?

When you run one of these scripts, does the blind actually open reliably?

Nope, there’s nothing in any tabs. And yes, I can run these scripts successfully and the blinds open/close reliably.

A change which I made in the meantime was the run mode. I changed it from the standard config to “relaunch” settings. I’ll see if this fixes the issue.

Update: I think the issue was coming from the previous script not fully finishing. I had no further similar issue since I changed the running mode.

Thanks all for help!