Scripts.yaml Response error: 500

I started to get Response error: 500 any time I created a script in the UI a while ago and just couldn’t figure out how to get rid of the error. There never seemed to be a solution to this in all of the searches that I did.

So I figured I would just create all of my scripts in scripts.yaml and skip the UI. That has worked out fine until just today. I created 3 tiny scripts, saved them and reloaded the yaml configuration. The scripts weren’t seen and I couldn’t call them from an automation. So I then restarted HA, and still the scripts aren’t seen.

I then created a scripts_new.yaml and had the configuration.yaml point to the new file instead of scripts.yaml. I put the three tiny scripts in the new file, saved and reloaded it. Still the scripts were not visible.

I emptied the scripts_new.yaml, saved and reloaded it. Opened the scripts UI and no scripts were seen - which was expected. I created a new script in the UI and did nothing other than just give it a name and save it and I get the “Response error: 500”.

I was hoping to start with a clean file and load each script one at a time to see if something was breaking the scripts file but I am totally baffled.

What can I do to get rid of this error? I can’t imagine not adding new scripts in the future. (There are no calls to the secrets.yaml in the 3 tiny scripts that I tried to create.)

Calling scripts_new.yaml

Empty scripts_new.yaml

No UI scripts

Error saving empty first script

Fixed but I think a crazy solution.

I removed script: !include scripts.yaml from configuration.yaml file.

I replaced it with script and an actual call to turn on a light.

I opened the UI and it wasn’t happy but saw the light script and gave me the option to migrate it. I did and saved the script. The new script shows up in the UI.

I deleted the script from the config file and replaced the !include scripts.yaml

I added another tiny script from the UI and all is happy. No more Response error: 500

Now I just need to add back all of my scripts one at a time and keep my fingers crossed.