# general


03/16/2023, 10:14 AM
Hi! I have a question: I am currently using the automation API to run Pulumi stuff. But sometimes it will fail, which can happen because the Dockerfile wasn't right or the user didn't have the appropriate rights. This is okay but then when I want to re-run the code it fails with:
Copy code
oncurrentUpdateError: code: -2
 stderr: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-demo --non-interactive
warning: A new version of Pulumi is available. To upgrade from version '3.55.0' to '3.58.0', run
   $ brew upgrade pulumi
or visit <> for manual instructions and release notes.
error: the stack is currently locked by 1 lock(s).
Then I have to manually fix this by running
pulumi cancel
. Is there a way to handle this in the code that when the pulumi operation fails to gracefully exit the process, so it doesn't stay locked?