EXEC : The remote server returned an error : (400) Bad Request


I have strange problem. I have few projects under OctoPack in my solution. Solution is build with Jenkins CI. I’m publishing the packs to Octopus. All of the packs are deployed without a problem except one. For the one I’m getting the “Failed to process request. ‘Bad Request’. EXEC : The remote server returned an error : (400) Bad Request…”. The funny thing is that if I run the build on that project from command line with publishing it works (it works also from a command line on the build server). Another funny thing is that the nuget gets to the Octupus server. I can see it in the packages. The project is nothing special.

What could it be?

Best regards,

Hi Marcin,

Thanks for getting in touch! Sorry this is giving you troubles.
Are you able to send us as many logs as possible. Build logs, Jenkins logs, just anything that will show us errors to help you get to the bottom of this.
I might also be a bit confused where this error is occurring and at what part of the process so a bit of an explanation might help.


Hi Vanessa,

I found the solution, without understanding why it’s not working. I’ve created a MSDeploy package while build (DeployOnBuild=True;CreatePackageOnPublish=true). I had
inside PropertyGroup in csproj. If I delete the DesktopBuildPackageLocation, the Nuget Package is deployed to Octopus.

The build log for the failing behavior is:
Package “xxx.zip” is successfully created as single file at the following location:
To get the instructions on how to deploy the web package please visit the following link:
Sample script for deploying this package is generated at the following location:
For this sample script, you can change the deploy parameters by changing the following file:
OctoPack: Written files: 2
OctoPack: A NuSpec file named ‘xxx.nuspec’ was not found in the project root, so the file will be generated automatically. However, you should consider creating your own NuSpec file so that you can customize the description properly.
OctoPack: Packaging a console or Window Service application
OctoPack: Attempting to build package from ‘xxx.nuspec’.
OctoPack: Successfully created package ‘C:\xxx\xxx.2.5.312.nupkg’.
OctoPack: OctoPack successful
Pushing xxx 2.5.312 to ‘http://localhost:83/nuget/packages’…
Failed to process request. ‘Bad Request’.
EXEC : The remote server returned an error : (400) Bad Request… [C:\xxx\xxx.csproj]
C:\xxx\trunk\lib\OctoPack.3.0.31\tools\OctoPack.targets(94,5): error MSB3073: The command "“C:\xxx\trunk\lib\OctoPack.3.0.31\tools\NuGet.exe” push “C:xxx\trunk\xxx\obj\octopacked\xxx2.5.312.nupkg” ******** -s http://localhost:83/nuget/packages " exited with code 1. [C:\xxx\trunk\xxx.csproj]

Best regards,

I ran into the identical issue. I was getting this error because my nupkg was already successfully published to the NuGet repository. Try incrementing the version number on the NuGet package to resolve this issue.

I had a similar problem. In my case it was related with TeamCity build miss-configuration - the package was pushed twice in the same version. The second try failed (with the entire build)

I had the same issue. The solution was to increment the versionnumber on the nuget package.

Thanks Scotty :slight_smile:


I’m also facing the same issue as discussed in this topic. First time, the build frm TFS succeeds. Second time, when I do a rebuild it fails. and the nuget package version remains unchanged.

If the solution is to increment the nuget package version, which exactly I should increment to ensure a successful build, because I see nuget package in 3 to 4 folders…

  • C:\Builds\1\TFS_WebApplicaion5\WebApplication5 I’ve 2 folders src and bin in which I see “WebApplication5.” and
  • another “WebApplication5.” in my drop folder in C:\Octopus\Packages\WebApplication5

Output of build message:

“C:\Builds\1\TFS_WebApplication5\WebApplication5\src\WebApplication5\WebApplication5.vbproj” (default target) (2) ->
(OctoPack target) ->
EXEC : The remote server returned an error : (400) Bad Request… [C:\Builds\1\TFS_WebApplication5\WebApplication5\src\WebApplication5\WebApplication5.vbproj]
C:\Builds\1\TFS_WebApplication5\WebApplication5\src\packages\OctoPack.3.0.45\tools\OctoPack.targets(105,5): error MSB3073: The command "“C:\Builds\1\TFS_WebApplication5\WebApplication5\src\packages\OctoPack.3.0.45\tools\NuGet.exe” push “C:\Builds\1\TFS_WebApplication5\WebApplication5\src\WebApplication5\obj\octopacked\WebApplication5.” API-xxxx -s http://localhost/octo/nuget/packages " exited with code 1. [C:\Builds\1\TFS_WebApplication5\WebApplication5\src\WebApplication5\WebApplication5.vbproj]

0 Warning(s)
2 Error(s)


Hi Dhana,

Thanks for getting in touch. I’m not sure why your build server is creating all those copies of your nuget package to be honest. What I’d recommend you to do is to remove Octopack from your project(s) and then check the video included on this doc where Paul explains how to setup Octopack properly

Let me know how it goes once you’ve done that



Hi Dalmiro,

Sorry for the delay… and thank you for pointing to that video… The video was helpful.

Earlier, I was using the below MSBuild argument:
/p:RunOctoPack=true /p:OctoPackPublishPackageToHttp=http://localhost/octo/nuget/packages /p:OctoPackPublishApiKey=API-XXXX

Now, I’ve just included one more parameter to the existing argument:
/p:RunOctoPack=true /pOctoPackPackageVersion= /p:OctoPackPublishPackageToHttp=http://localhost/octo/nuget/packages /p:OctoPackPublishApiKey=API-XXXX

Kept incrementing the OctoPackPackageVersion via the MSBuild argument every time I do a rebuild and my builds went through successfully…