How to resolve issue with scripts.yaml

OK, I’ve been stupid…twice!

First: I failed to back up my Home Assistant - should’ve known better.

Second: I had been using the GUI to create a number of scripts successfully.
I went on to FTP the scripts.yaml file to the PC, used notepad++ to make some changes and FTP it back successfully.
Then, I got a bit too blasé about it all.
Now, it doesn’t matter which script that I attempt to view in the GUI, I receive the message “Only scripts inside scripts.yaml are editable.”
The scripts still work as they are meant to but I cannot access any script via the GUI to check how I achieved anything.
I have confirmed that the scripts are inside scripts.yaml but I guess that my actions have screwed the file in some way.

My questions are:

  1. Is there any way that I can analyse the scripts.yaml file to determine what is wrong?
  2. Is there any way that I can restore the scripts.yaml file?
  3. To avoid this situation in the future; is there a way to keep my scripts.yaml file for GUI-produced scripts only and use a separate file for my “manually-produced” scripts?

I hope that I have given you a laugh at my expense - I deserve it.

Best,
Joe.

  1. only by manually doing it. Maybe posting the contents of the file here for a fresh set of eyes? Unless it’s too massive. :wink:

  2. not unless you have a backup. Which it sounds like you don’t. But you CAN copy all of the contents of the file and then delete everything in the file to producer a blank file and start adding them back one at a time manually to see if there’s one that might be tripping you up. Also another thing to make sure of is that every script needs a unique id to make it editable. if you erased those somehow that would also cause issues.

  3. you can just use an !include with a modified “script x:” key and point that to the correct manually created scripts file.

I don’t have one for scripts but my config for automations is like this:

## only used for the testing of the GUI editors
automation: !include automations.yaml

## All of my regular automations go here
automation yaml: !include_dir_merge_list automations/

you can convert that to use with your scripts like this:

script: !include scripts.yaml

script manual: !include script_manual.yaml

Many thanks for your comprehensive response.

I thought that it was likely that the only feasible solution was your response to my second question - copy the contents of scripts.yaml, empty the file and copy the scripts back one-by-one. You’ve confirmed that, so thank you.

Additionally, thanks for the response to my third question - it has given me a good idea about how to proceed.

All-in-all, an extremely helpful and informative response, which merits being marked as the solution.

I am extremely grateful.

1 Like

Well, it seems that I was somewhat premature with believing that I had a resolution to the issue with my scripts.yaml file.

I attempted copying the contents of the scripts.yaml file off to my PC. I renamed the scripts.yaml to 20221009_orig_scripts.yaml, using the unix mv (move) command, so that I would be starting with a completely fresh scripts.yaml file.

It didn’t matter which script that I copied back; when I attempted to open it by clicking Information, then the pencil icon, I received the “Only scripts inside scripts.yaml are editable.” message.

I started with an empty scripts.yaml and created a new script using the GUI editor. Checked the configuration and restarted. With just the single script in scripts.yaml, when I clicked Information, then the pencil icon, I received the “Only scripts inside scripts.yaml are editable.” message again.

It seems that the issue that I’m experiencing has nothing to do with the contents of the scripts.yaml file. I guess that I’m going to have to accept that the only way to edit the scripts.yaml file is either from the command line or copying the file out, editing it with notepad++, and copying it back.

Thanks everyone for their assistance.

Hi,

I am having the same issue since a few weeks ago (must have been an update of HA from 2022.09.x to 2022.10.x).

I can edit automation and scenes via GUI but when I edit the scripts.yaml, it just complains (“Only scripts inside scripts.yaml are editable.”).

I also tried to remove the scripts.yaml and created a blank new file. I created a simple script via GUI. It works just fine. When I try to edit this script via GUI, I get the same error message again (“Only scripts inside scripts.yaml are editable.”).

I checked the file access rights via ssh and they are just like for all other files (automations.yaml, scenes.yaml,…).

Any solution yet?

Btw: I am running Home Assitant 2022.10.5

Many thanks!

Hi >f.ahlers,
I’m sorry that I have not responded until now.
I have done all my editing of the scripts.yaml file in yaml.
However, yesterday I found that I could open the scripts in the GUI again. An update must have enabled this but I don’t know which one. All I can say is that I am currently running Home Assistant OS 9.3 with Home Assistant Core 2022.11.3.

I hope that this assists you.