Response status code does not indicate success: 401 (Unauthorized)

Hi there,

We have TeamCity set up and it is failing to push the package to octopus. for a reason.
We haven’t done a deploy for a while and it looks like something is out of date.
Would you be able to to point me to the right direction please.

logs saying the below:
Step 6/8: Publish package to Octopus (NuGet Publish) (34s)
[09:17:57][Step 6/8] ##teamcity[buildStatisticValue key=‘buildStageDuration:buildStepRUNNER_5’ value=‘0.0’]
[09:17:57][Step 6/8] push: Publish package artifacts\Serialization. (33s)
[09:17:57][push] NuGet command: P:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT\tools\NuGet.exe push P:\TeamCity\buildAgent\work\4c1e8fe97c39e889\artifacts\Serialization. %%teamcity_nuget_api_key%% -Source http://build:81/nuget/packages
[09:17:57][push] Starting: P:\TeamCity\buildAgent\temp\agentTmp\custom_script4234139737867738432.cmd
[09:17:57][push] in directory: P:\TeamCity\buildAgent\work\4c1e8fe97c39e889\artifacts
[09:18:06][push] Pushing Serialization. to ‘http://build:81/nuget/packages’…
[09:18:08][push] PUT http://build:81/nuget/packages/
[09:18:29][push] Please provide credentials for: http://build:81/nuget/packages
[09:18:30][push] UserName: Password: Object reference not set to an instance of an object.
[09:18:30][push] Unauthorized http://build:81/nuget/packages/ 21379ms
[09:18:30][push] Response status code does not indicate success: 401 (Unauthorized).
[09:18:31][push] Process exited with code 1
[09:18:31][Step 6/8] ##teamcity[buildStatisticValue key=‘buildStageDuration:buildStepRUNNER_5’ value=‘34094.0’]
[09:18:31][Step 6/8] Step Publish package to Octopus (NuGet Publish) failed


Thanks for reaching out. The issue seems to be happening when the build is runnign the below command:

401 unauthorized means that the API key that’s being used for the package push is either invalid or doesn’t have enough permissions.

It seems like %%teamcity_nuget_api__key%% is not being resolved properly? Perhaps it should be just %teamcity_nuget_api__key% without the extra set of %? Or is that something that you sanitized when you sent the log?

Best regards,

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