System.FormatException on create release


since last friday I have the problem when teamcity wants to create a release (or I want to do it manually on the octopus server) I get an error: “The current value ‘String’ type is not compatible with the expected ‘System.DateTimeOffset’ type.”

this error is caused by the call: http://our.server/deploy/api/feeds/feeds-teamcity/packages?packageIds=Backend.Services.WebDataAccessLayer

“ErrorMessage”: “The current value ‘String’ type is not compatible with the expected ‘System.DateTimeOffset’ type.”,
“FullException”: “System.InvalidOperationException: The current value ‘String’ type is not compatible with the expected ‘System.DateTimeOffset’ type. —> System.FormatException: The string ‘2015-05-15T10:20’ is not a valid AllXsd value.\r\n at System.Xml.XmlConvert.ToDateTimeOffset(String s)\r\n at System.Data.Services.Client.ClientConvert.ChangeType(String propertyValue, Type propertyType)\r\n — End of inner exception stack trace —\r\n at System.Data.Services.Client.ClientConvert.ChangeType(String propertyValue, Type propertyType)\r\n at System.Data.Services.Client.AtomMaterializer.MaterializeDataValue(Type type, AtomContentProperty atomProperty, DataServiceContext context)\r\n at System.Data.Services.Client.AtomMaterializer.MaterializeDataValues(ClientType actualType, List1 values, Boolean ignoreMissingProperties, DataServiceContext context)\r\n at System.Data.Services.Client.AtomMaterializer.MaterializeResolvedEntry(AtomEntry entry, Boolean includeLinks)\r\n at System.Data.Services.Client.AtomMaterializer.DirectMaterializePlan(AtomMaterializer materializer, AtomEntry entry, Type expectedEntryType)\r\n at System.Data.Services.Client.AtomMaterializer.Read()\r\n at System.Data.Services.Client.MaterializeAtom.MoveNextInternal()\r\n at System.Data.Services.Client.MaterializeAtom.MoveNext()\r\n at NuGet.DataServiceQueryWrapper1.d__7.MoveNext()\r\n at System.Collections.Generic.List1..ctor(IEnumerable1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)\r\n at NuGet.PackageRepositoryExtensions.FindPackagesById(IPackageRepository repository, String packageId)\r\n at Octopus.Server.Web.Api.Actions.PackageSearchAction.<>c__DisplayClass3c.<Versions>b__38(String p) in y:\\work\\refs\\heads\\master\\source\\Octopus.Server\\Web\\Api\\Actions\\PackageSearchAction.cs:line 105\r\n at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()\r\n at System.Linq.Buffer1…ctor(IEnumerable1 source)\r\n at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)\r\n at Octopus.Server.Web.Api.Actions.PackageSearchAction.Execute() in y:\work\refs\heads\master\source\Octopus.Server\Web\Api\Actions\PackageSearchAction.cs:line 41\r\n at Octopus.Platform.Web.Api.Responder1.Respond(TDescriptor options, NancyContext context) in y:\\work\\refs\\heads\\master\\source\\Octopus.Platform.Web\\Api\\Responder.cs:line 163\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n at CallSite.Target(Closure , CallSite , Object , Object , NancyContext )\r\n at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass5.<.ctor>b__2(Object o) in y:\\work\\refs\\heads\\master\\source\\Octopus.Server\\Web\\Api\\OctopusRestApiModule.cs:line 47\r\n at CallSite.Target(Closure , CallSite , Func2 , Object )\r\n at Nancy.Routing.Route.<>c__DisplayClass4.b__3(Object parameters, CancellationToken context)”

My guess was that one of the nuget packages has a wrong publish date - 2015-05-15T10:20 I tried to remove all nuget-packages (manually and with the help of retention policies, but nothing worked.

I am using version: Octopus Deploy


Hi Thomas,

This is a rather tricky error. If you check the date printed on the exception, you’ll notice that it doesnt have the seconds: 2015-05-15T10:20. What happens is when a NuGet Package is created at a set time such as this 10:20:00:00 The zero’s are dropped from the DateTimeOffset, and completely break NuGet. As the error comes from right in the middle of NuGet system it isn’t something we can provide a fix this.

So the workaround is to recreate your package and hope that it doesn’t get created at zero seconds and zero milliseconds on the build.

You are saying though that you’ve been having this issue since friday. Is it possible that you always used the same package to create your releases?



Hi Dalmiro,

thanks for your fast response and the info about the problem.

No, every release has its own package number. Usually the release is created automatically via TeamCity, after the build and tests were successful. I did a workaround to get our latest build on the first stage by fill in the number of the latest release from TeamCity manually (as you can see on the attached image). However I would like to ‘clear’ the repository or the nuget feed, because the problem is still there. (Everything works, only the call to get the latest nuget package has an error reading the nuget information).

Are you using Octopus’ nuget feed or TeamCity’s? This is most likely being caused by a package with a corrupt date. Do you think it’ll be possible for you to find this specific package and delete it?


I am using TeamCity’s nuget feed. I deleted all nuget packages on the server. However the problem was still there. I was able to fix it with the help of stackoverflow ( ). The solution was to clear the package cache, by going to http://{teamcity}/admin/admin.html?item=diagnostics&tab=cache and clicking “reset” next to “buildsMetadata”.

Now everything works fine again. Thanks for your help and thanks for your great product which makes my life a lot easier here. Keep up the good work.

Hi Thomas,

Sorry to hear you had to delete the packages. Thank you for taking the time to share your workaround! hopefully it’ll help other users running into the same error

Thanks for the kind words as well :slight_smile:


Just wanted to chime in since I was having an identical error (though my timestamp wasn’t an 00 one).

I used the["http://{teamcity}/admin/admin.html?item=diagnostics&tab=cache and clicking “reset” next to “buildsMetadata”] fix and worked for me.

I also did NOT have to actually delete packages in TeamCity, just reset the buildsMetadata cache.

I can confirm that clearing the buildMetadata cache worked for us to fix this error.

I can also confirm that clearing the buildMetadata cache worked for us to fix this error.

@ Ryan Hayes
Thank you for resolution. This solved my error as well.


This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.