Migrating Octopus server - Handshaking with Octopus server - The handshake failed due to an unexpected packet format

We had Octopus Deploy 2.4.8.107 running on a server for some time, but then had to migrate it to another server. The migration process is as follows:

  1. Install Octopus server on the new VM
  2. Restore Octopus backed-up DB on new VM
  3. Stop old Octopus VM
  4. Update DNS to point octopus to new Ocotopus VM

Everything worked fine until we used Octo.exe, we get the error in the code block below any time we use it.
The error occurs even when running Octo.exe on the Octopus Server VM.

Do I need to import an SSL cert? or update one?

@@@
PS C:\Octopus> .\Octo.exe list-projects --server=http://octopus:9090 --apikey=API-XXXXXXXXXXXXXXXXXXX (masked API key)
Octopus Deploy Command Line Tool, version 2.4.5.18

Handshaking with Octopus server: http://octopus:9090
System.Exception: Unable to connect to the Octopus Deploy server. See the inner exception for details. —> System.Net.W
ebException: The underlying connection was closed: An unexpected error occurred on a send. —> System.IO.IOException: T
he handshake failed due to an unexpected packet format.
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncReq
uest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRe
quest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.TlsStream.CallProcessAuthentication(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object
state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, B
oolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
— End of inner exception stack trace —
at System.Net.HttpWebRequest.GetResponse()
at Octopus.Client.OctopusClient.DispatchRequest[TResponseResource](OctopusRequest request, Boolean readResponse)
at Octopus.Client.OctopusClient.Get[TResource](String path, Object pathParameters)
at Octopus.Client.OctopusClient.EstablishSession()
— End of inner exception stack trace —
at Octopus.Client.OctopusClient.EstablishSession()
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at System.Lazy`1.get_Value()
at Octopus.Client.OctopusClient.get_RootDocument()
at OctopusTools.Commands.ApiCommand.Execute(String[] commandLineArguments)
at OctopusTools.Program.Main(String[] args)
Exit code: -3
@@@

Hi Richard,

Is your Octopus server configured to use HTTPS? It looks like you are specifying HTTP when connecting: --server=http://octopus:9090

If you are using HTTPS, the certificate that you configure for HTTPS needs to be trusted on the server that you are running Octo.exe on. When you open a web browser and navigate to the Octopus web UI, do you get any certificate warnings? If you are using a self-signed certificate on the Octopus server you’ll need to export that certificate and trust it on the server you are running Octo.exe on.

Hope this helps!

Paul