Team City Nuget search returning 401 Unauthorized


I have upgraded from OD to
I ran a deployment from Team City (Server version 7.1.1 build 24074) and received an error with the build where octopus failed to retrieve packages from the Team City nuget feed.

The errors from both Team City and Octopus logs are at the bottom of this post.

It is an authenticated nuget feed. I have tested the credentials through other nuget feed query services such as VS2012 and authentication is fine. It is only when trying through OD2 that it appears to fail.

I had also updated the TC-OD plugin to the latest release also.

When testing credentials in OD2 for the nuget service I tried the following:


None of which seemed to work they all returned the 401 Unauthorised message when searching for packages.

I have since stopped all version 2 services (Deployment server and Agents) and thankfully had decided not to remove 1.6 yet. So at the moment I am continuing to use 1.6. It is working fine.

Has anyone else come across this recently? I have found this link but I am not sure if this is causing the problem?

Here are the log entries

Octopus Deploy 2

2014-02-04 10:19:08.3535  ERROR  Unhandled error on request: http://octopus.pronamics.local/api/feeds/feeds-1/packages?packageId=E&partialMatch=true&take=10 : The remote server returned an error: (401) Unauthorized.
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at System.Net.HttpWebRequest.GetResponse()
   at NuGet.RequestHelper.GetResponse(Func`1 createRequest, Action`1 prepareRequest, IProxyCache proxyCache, ICredentialCache credentialCache, ICredentialProvider credentialProvider)
   at NuGet.HttpClient.GetResponse()
   at NuGet.RedirectedHttpClient.GetResponseUri(HttpClient client)
   at NuGet.RedirectedHttpClient.EnsureClient()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at NuGet.RedirectedHttpClient.get_CachedClient()
   at NuGet.RedirectedHttpClient.get_Uri()
   at NuGet.DataServicePackageRepository.GetPackages()
   at Octopus.Server.Web.Api.Actions.PackageSearchAction.SearchForPackagesNamedLike(IPackageRepository repository, String packageId, Int32 take) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 124
   at Octopus.Server.Web.Api.Actions.PackageSearchAction.Search(String feedId, String packageId, Boolean partialMatch, Boolean includeMultipleVersions, Boolean includeNotes, Boolean includePreRelease, Int32 take) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 59
   at Octopus.Server.Web.Api.Actions.PackageSearchAction.Execute() in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 42
   at Octopus.Platform.Web.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Platform.Web\Api\Responder.cs:line 163
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at CallSite.Target(Closure , CallSite , Object , Object , NancyContext )
   at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass5.<.ctor>b__2(Object o) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 47
   at CallSite.Target(Closure , CallSite , Func`2 , Object )
   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)

Team City 7.1.1

[2014-02-04 10:19:07,740]   INFO -   jetbrains.buildServer.SERVER - Login for user "" failed: com.sun.jna.platform.win32.Win32Exception: The token supplied to the function is invalid

(Occurs 7 times)

Thanks for opening up the thread - we’re looking into this one.

Thanks Nick,

It could be a network environment issue maybe, but the strange thing is that 1.6 is still functioning correctly.

[Pronamics_Email_Logo_03-04-13A.jpg] Wild | Information Systems Administrator / Software Developer
Telephone +61 7 3481 9666
Sales +61 7 3481 9676 | 24/7 Support +61 7 3481 9626 | Training +61 7 3481 9686
LinkedIn | Facebook | Twitter |


The contents of this email message and any attachment(s) is for the exclusive viewing and use of the addressee(s) identified. It may contain confidential, proprietary and/or privileged information. The sender does not waive any confidentiality and/or privilege should any mistransmission occur or should this message be received by any unintended recipient. If you are not the intended recipient of this email message you must not view, copy, print, forward or otherwise use the email message and/or attachment(s). You are requested to delete the email message and contact the sender to advise that you have received it. Pronamics Pty Ltd does not accept any responsibility for the content of any email sent by an employee which is of a personal nature. Pronamics Pty Ltd scan outgoing emails with virus protection software but cannot guarantee that this email message and/or attachment(s) is free from viruses and/or other malicious code. We recommend that you take appropriate measures to protect your system. Save a tree. Don’t print this e-mail unless it’s really necessary!