There are two possibilities for you to see this error.
1) The action that you specified is incorrect.
You need to specify the action name, not the status name.
For example, in the default state, the action name of the status "Completed" is "Complete," so you need to specify "Complete" in the program.
2) The status that you want to change is not supported by the record's current status.
For example, the default state of the statuses is:
Not started > In progress > Completed
You can't change the status to "Completed" when it is still in "Not started."
The only status you can change from "Not started" is to "In progress."
I hope this helps,