Deployment doesn't stop after permission denied with DbUp

We recently upgraded Octopus Deploy from version 2020.3 to 2020.6 and use DbUp for deploying database scripts.
In the 2020.3 version Octopus returned an error “The remote script failed with exit code -1” if a permission denied would occur during deployment with DbUp and the deployment would stop and show it failed.
With version 2020.6 after the same permission denied error the deployment continues and shows a successful deployment so it looks like the deployment is succesful but not all scripts are executed.
Can you please investigate this?

Hi @licenties,

Thank you for contacting Octopus Support. I’m sorry that you are running into this issue.

Would it be possible for you to send me 3 raw tasks logs, including:

  • A failed deployment from 2020.3
  • A failed deployment from 2020.6
  • A successful deployment from 2020.6

You may attach them here, PM them to me directly, email them to or use this secure upload link.

I look forward to hearing back from you.


Thanks for your reply Donny! I’ll send you a pm with the tasks logs.

Hi @licenties,

Thank you for getting back to me.

I’m going to try to reproduce this in a test environment.

I appreciate your patience while I look into this.


Hi @licenties,

Thank you for your patience.

A colleague and I looked into this and we believe we were able to replicate the issue. It looks like this is likely stemming from how Program.cs is configured as this is what dictates the exit code used for determining success/failure. In the 2020.6 example you provided, the job exited with an exit code of 0. However, in the 2020.3 run, it looks like Program.cs was configured to throw a -1 exit code for the same error.

Here is the output from our initial test:

Here is the output from the same test, but with one change made to Program.cs:

This is the change that was made:

I’m happy to take a look at the code in your Program.cs if you wish to share it. Otherwise, I would recommend combing over Program.cs and making sure the exit codes are set as you need them.

Let me know your thoughts at your earliest convenience.


Many thanks for the effort! I’ve sent this to our devteam and they will modify the porgram.cs
The help is very much appreciated! You can set the topic to resolved.
Thanks again and have a wonderful day :slight_smile:

Best regards,



This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.