InvalidOperation: The requested object does not exist

We are using a self hosted Octopus Deploy v2021.2 (Build 7580).
We have a deployment that previously worked, its a Windows Service that gets deployed then started.

When we now run the deployment we get -

....
[SC] ChangeServiceConfig SUCCESS 
March 31st 2022 14:43:15Info
Updating the service description 
March 31st 2022 14:43:15Info
[SC] ChangeServiceConfig2 SUCCESS 
March 31st 2022 14:43:15Error
InvalidOperation: The requested object does not exist. (Exception from HRESULT: 0x80010114) 
March 31st 2022 14:43:15Error
At C:\MyInstallDir\Octopus.Features.WindowsService_BeforePostDeploy.ps1:195 char:25 
March 31st 2022 14:43:15Error
+     $currentStartMode = Get-WMIObject win32_service -filter "name='$($serviceNam ... 
March 31st 2022 14:43:15Error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
March 31st 2022 14:43:15Error
at <ScriptBlock>, C:\MyInstallDir\Octopus.Features.WindowsService_BeforePostDeploy.ps1: line 195 
March 31st 2022 14:43:15Error
at <ScriptBlock>, <No file>: line 1 
March 31st 2022 14:43:15Error
at <ScriptBlock>, C:\MyInstallDir\Octopus.FunctionAppenderContext.ps1: line 189 
March 31st 2022 14:43:15Error
at <ScriptBlock>, C:\MyInstallDir\Bootstrap.Octopus.FunctionAppenderContext.ps1: line 1656 
March 31st 2022 14:43:15Error
at <ScriptBlock>, <No file>: line 1 
March 31st 2022 14:43:15Error
at <ScriptBlock>, <No file>: line 1 
March 31st 2022 14:43:15Error
Running rollback conventions... 
March 31st 2022 14:43:15Error
Script 'C:\MyInstallDir\Octopus.Features.WindowsService_BeforePostDeploy.ps1' returned non-zero exit code: 1 
March 31st 2022 14:43:15Fatal
The remote script failed with exit code 1 
March 31st 2022 14:43:15Fatal
The action Deploy Scheduled Reports Service on DEVELOPMENT WEB-01 failed 

Hi David,

Thanks for reaching out and welcome to the forum!

It looks like the script block that’s being executed and having issues is here in our Calamari code:

According to our comment in the code just above that, this is a fallback method if the service status isn’t defined in the Deploy a Windows Service step:

This is the fallback for any steps that don’t define a desired status (which is every step before the new desired status option was added). It retains the old behaviour of starting services based on the start mode.

I was wondering what happens if you try defining the desired status in the step (if you haven’t already)? That might then skip this script block and allow the service to deploy successfully.

Let me know if that’s helpful!

Best,
Patrick

Hi Patrick,

Thanks for the info, I changed to desired state to STARTED & the deployment worked !
It did have “When will the service start?” set to default, but changing it to STARTED made it work.

Thanks again.
Dave

1 Like

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