Search code examples
octopus-deploy

Octo fails on push with json error (Octopus Deploy)


We are using octo to package and push our package to the Octopus Server. The command we run is below, this was working and now we are getting a very weird deserialisation error.

octo.exe push --server http://51..../ --apikey SECRET --package C:\TeamCity\buildAgent\temp\buildTmp\ZipPreprocessor1003810446440595334\7.zip --replace-existing --debug

Before we used to get

octo.exe push --server http://51......../ --apikey SECRET --package C:\TeamCity\buildAgent\temp\buildTmp\ZipPreprocessor8586972988812470737\6.zip --replace-existing --debug
Pushing packages to Octopus server
Octopus Deploy Command Line Tool, version 4.31.1

Handshaking with Octopus server: http://51......./
Handshake successful. Octopus version: 2018.3.1; API version: 3.0.0
Authenticated as: admin <null> 
Pushing package: C:\TeamCity\buildAgent\temp\buildTmp\ZipPreprocessor8586972988812470737\6.zip...
Push successful
Octo.exe exit code: 0

Now we are getting this json exception

octo.exe push --server http://51....../ --apikey SECRET --package C:\TeamCity\buildAgent\temp\buildTmp\ZipPreprocessor1003810446440595334\7.zip --replace-existing --debug
Pushing packages to Octopus server
Octopus Deploy Command Line Tool, version 4.31.1


Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Newtonsoft.Json.JsonTextReader.ParseValue()
   at Newtonsoft.Json.JsonTextReader.Read()
.... stack trace 

Does anyone know what files octo.exe attempts to read before outputting messages, or have any idea on what is going on here.


Solution

  • The error JsonReaderException: Unexpected character encountered while parsing value: <. shows up because Octo.exe was expecting a JSON blob after an HTTP call, and instead received an HTML doc (that starts with <).

    I recommend you to setup Fiddler in the machine where you are running Octo.exe, and try to run that command again. That way you'll be able to inspect the full HTML you are getting back, which will have in its body the actual error message you care about.