Unable to download package when using "Run on Octopus Server" in Execution plan

Error

The error message is:

Unable to download package: One or more errors occurred. …
System.Exception: Error downloading …

See error-output.txt for the raw details

The issue only happens when the Octopus server itself needs a package, tentacles download packages fine.

Error Capture

What we see:

  • zero bytes files created server cache, example D:\Octopus\OctopusServer\PackageCache\feeds-klondike\OctopusScripts.1.0.170105.88_54E4BE37DEA29B4BB43933697C8EED62.nupkg
  • We see Octopus Server making successful request to Klondike
"GET /api/odata/Search()?$filter=IsAbsoluteLatestVersion&searchTerm='octopusscripts'&targetFramework=''&includePrerelease=true&$skip=0&$top=10 HTTP/1.1" 200 3249
"GET /api/odata/FindPackagesById()?id='OctopusScripts' HTTP/1.1" 200 33321
"GET /api/odata/Packages(Id='OctopusScripts',Version='1.0.170105.88') HTTP/1.1" 200 2951

What we have tried

  • Upgrading Octopus, nuget.exe, octo.exe, Klondike - all latest now including Octopus Server
  • Restarting the world
  • Using ProGet instead of Klondike
  • Creating different .nupkg files in different ways including some they worked before

Please help

error-output.txt (27 KB)

To replicate this issue:

  1. In step templates create one that Runs a Script
  2. Configure script source in the step template to be Script file inside a package

package script

  • Choose any Nuget Feed, any Package and enter any Script Name
  • Create a process in a project that uses this Step Template
  • In that process configure the Execution Plan to be in Octopus Server

The problem here is that Octopus Server (Octopus Tentacles work fine) cannot download packages from Nuget Feed

Hi,

Thanks for getting in touch.

Unfortunately I haven’t been able to reproduce the issue you are seeing running a script from a package on the Octopus Server.

Would you mind trying with a package from NuGet (https://www.nuget.org/api/v2/) and seeing if you have any luck? (for example the OctoPack package)

Can you retrieve your package using NuGet.exe (https://dist.nuget.org/index.html) while on the Octopus Server? You may need to add your repository using NuGet.exe sources and then install with NuGet.exe install.

Cheers,
Shane

Hi Shane, thanks for your help and sorry for the late response.

I have tried other NuGet feeds it fails on all of them. NuGet.exe works fine, using same package, folder, username… it is definitely not the Feed itself.

Out of desperation I have build a new Octopus Server, same version, same network, same users and after setting up a test project it works fine!

So my guess now is that something is corrupted in my existing Octopus Server and my efforts are now around restoring Octopus data into this new empty server.

Hi Angel,

That’s unfortunate to hear :frowning:

Does a new Octopus instance on the same box have problems accessing NuGet feeds?

Does uninstalling and re-installing help? (You can uninstall without losing your instances, just make sure to take a backup of your master key).

My first instinct was a network issue (proxy/firewall) but if you can access from the same network and via NuGet.exe it seems unlikely. I could make a utility that does the same download process to help us debug the issue but if you are committed moving to the new server it may not be worth it.

Cheers
Shane

Hi Shane,

The new instance works fine with NuGets. I am going to try the re-install of Octopus, as you suggested, as soon as I have a maintenance window.

Yesterday I tried duplicating our Octopus installation in a new server, did this:

  1. Stopped current Octopus
  2. Duplicated database
  3. Copied over the entire Octopus home folder to the new server
  4. Run installation in new server connecting to the DB copy, pointing to the copied home folder and entering the same master key.

It failed to start with an exception message: “Key not valid for use in specified state.”

What am I missing? How do you restore Octopus in a new server from the DB and home folder backup?

Best,
Angel.

Hi Angel,

I think the problem you are encountering is because the master key contained in the Server.config file you copied over can not be used on another machine. When you set up the new instance you will need to point it at your duplicated Octopus database and enter the master key of your old instance. This will create a new Server.config with a master key encrypted for use on your new machine - do not replace this one with your old one.

Cheers
Shane

Hi Shane,

Thanks for that, it did the trick.

So we restored the DB and the home folder in another server (deleting the OctopusServer.config), then run the installation entering the master key.

The new server clone starts fine and Nuget feeds work fine again so all fixed.

My guess is the old Octopus server installation was corrupted in some way (it has had a lot of upgrades over the years), maybe a re-install would have fixed it but I was trying solutions that were always leaving the old server intact.

Thanks for your help again.