Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop action in automation throws error on save when a return variable is present and "Stop on Unexpected Error" is toggled on then off #116429

Open
tomkessler opened this issue Apr 29, 2024 · 1 comment

Comments

@tomkessler
Copy link

tomkessler commented Apr 29, 2024

The problem

It seems that it's not possible to set a return value from the Stop action in an automation if the "Stop because of an unexpected error" toggle is set to TRUE. This makes sense to me. That said, the documentation (cited below) doesn't mention it, so I am making a bit of an assumption here.

Using the action and setting a return variable when the "Stop because of an unexpected error" toggle has never been touched works fine, which is to say the automation will save without an error.

Using the action and setting a return variable with the "Stop because of an unexpected error" toggle set to TRUE throws the following error, which is expected per my reasoning above -- although the error is not very user friendly.

Message malformed: not allowed to add a response to an error stop action @ data['action'][0][<error_or_response>]

However, if after seeing the error, you then toggle the "Stop because of an unexpected error" toggle back to OFF, the error persists and you can't save the script.

A workaround is to switch to YAML mode and remove the error: false map item altogether.

Seems the code may be checking for the "error" key instead of checking it's value?

What version of Home Assistant Core has the issue?

2024.4.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

No response

Link to integration documentation on our website

https://www.home-assistant.io/docs/scripts/#stopping-a-script-sequence

Diagnostics information

No response

Example YAML snippet

This won't save, but presumably should.


description: ""
mode: single
trigger: []
condition: []
action:
  - stop: We're done here
    response_variable: test
    error: false
alias: test

Anything in the logs that might be useful for us?

No response

Additional information

No response

@tomkessler tomkessler changed the title Stop action in automation throws error when a return variable is present and "Stop on Unexpected Error" is toggled on then off Stop action in automation throws error on save when a return variable is present and "Stop on Unexpected Error" is toggled on then off Apr 29, 2024
@home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (automation) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of automation can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign automation Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


automation documentation
automation source
(message by IssueLinks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants