Scripts dissappear or can't be selected as actions in automations

Like many folks, I have automations that call scripts. I added a couple of new scripts and tried to use them as actions in a new automation, but the “Scripts” option did not even appear as a category for the action selection. Exitsing automations that call scripts showed errors in teh UI where the script would have been shown as an action.

Rebooted HA but still no scripts. Tested running some scripts from the Scripts tab and that worked fine. A few minutes later, lo and behold, the scripts were back.

Then it happened again a few minutes later after I created a couple of new scripts, but that time I could see the Scripts category when selecting an action for an automation and I could see some scripts, bt my new scripts were not included in the list even after reloading the confidguations.

A few minutes later, the new scripts showed up to be selected as actions.

Is this normal??? I’m running HA natively on a NUC with lots of RAM, and my network is solid.

This often happens if the script key in the configuration.yaml have been used twice.

Thanks much. What’s a script key? Looking thorugh my scripts.yaml file (which is included in my configurations.yaml file), nothing jumps out at me. I assume the key is a unique (or supposed to be unique) attribute of a particular script?

You can verify this by opening the scripts.yaml file. The file is in the same folder as configuration.yaml normally.

The file format is:

script1_key:
  alias: 'Alias name'
  sequence:
    - ...
    - ...
script2_key:
  alias: 'Alias name'
  sequence:
    - ...
    - ...

You must make sure that you don’t have the same key used for more than one script, as adviced by @WallyR

In the configuration.yaml you might have added script: twice.
Sometimes it is written in the configuration.yaml and then also in some file that is included with an !include command.

Thanks again. I have confirmed that there are no duplicate keys in scripts.yaml. I have used only the UI to create scripts and have never edited that file, so if there was a dup key, HA added it erroneously and subsequently fixed it. Or the issue was something else. I’ll just have to see if it happens again.

I know it’s a lot, but show us your scripts.yaml.
Liberally remove confidential information, like logins and passwords, with ###