Object reference error when indexing/manipulating packages of specific name

Hi I was trying to push a package to my company’s feed using Octo.exe, got a 500 response from the tool:

Something went wrong while performing a delta transfer: Octopus Server returned an error: Object reference not set to an instance of an object.
Falling back to pushing the complete package to the server
Octopus Server returned an error: Object reference not set to an instance of an object.

I observed the file did uploaded successfully to the server filesystem, but was not properly indexed/able to view through the GUI.

I attempted to upload the package manually through the GUI unsuccessfully with a similar Object reference not set to instance of an object error.

I see the following when attempting to re-index:

Re-indexing packages.
January 6th 2020 12:17:55Info
Added package ‘************.tar.gz’ to index.
January 6th 2020 12:18:01Warning
Error inserting package details into database. Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Octopus.Server.Web.Api.ModelRestrictionMap.PackageUsages.<>c__DisplayClass1_0.b__2(PackageReference p) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Api\ModelRestrictionMap\PackageUsages.cs:line 30
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at System.Linq.Enumerable.<DistinctIterator>d__641.MoveNext()
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Octopus.Server.Web.Api.ModelRestrictionMap.PackageRestriction.CheckPermissionInProjects(IndexedPackage model, ISpacePartitionPrincipal principal, IOctopusQueryExecutor queryExecutor, Permission permissionToCheck) at Octopus.Server.Web.Infrastructure.Security.DocumentRestrictions.CompositeAndRestriction2.CombineWithAnd(Func2 check) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\DocumentRestrictions\CompositeAndRestriction.cs:line 44 at Octopus.Server.Web.Infrastructure.Security.DocumentRestrictions.CompositeAndRestriction2.CombineWithAnd(Func2 check) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\DocumentRestrictions\CompositeAndRestriction.cs:line 44 at Octopus.Server.Web.Infrastructure.Security.AccessChecker1.CanCreate(TModel model)
at Octopus.Core.Security.Permissions.AccessCheckerExtensions.AssertCanCreate[TModel](IAccessChecker1 accessChecker, TModel model) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\Security\Permissions\IAccessChecker.cs:line 46 at Octopus.Server.Web.Infrastructure.OctopusQueryExecutor.Insert[TDocument](TDocument instance, Nullable1 commandTimeout) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\OctopusQueryExecutor.cs:line 200
at Octopus.Core.BuiltInFeed.BuiltInPackageIndex.AddPackage(IndexedPackage package) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\BuiltInFeed\BuiltInPackageIndex.cs:line 29
at Octopus.Server.Orchestration.ServerTasks.SynchronizeBuiltInPackageRepositoryIndex.SynchronizeBuiltInPackageRepositoryIndexTaskController.AddPackagesToIndex(ICollection`1 packages) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Orchestration\ServerTasks\SynchronizeBuiltInPackageRepositoryIndex\SynchronizeBuiltInPackageRepositoryIndexTaskController.cs:line 207
at Octopus.Server.Orchestration.ServerTasks.SynchronizeBuiltInPackageRepositoryIndex.SynchronizeBuiltInPackageRepositoryIndexTaskController.IndexPackages() in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Orchestration\ServerTasks\SynchronizeBuiltInPackageRepositoryIndex\SynchronizeBuiltInPackageRepositoryIndexTaskController.cs:line 181
Octopus.Server version 2019.9.5 (2019.9.5+Branch.tags-2019.9.5.Sha.bbd39bbd6111cc9fc161af841722641afec2376d)
January 6th 2020 12:24:08Info
Built-in package repository re-indexed with 1 new package.

I also observed that I was able to successfully upload the package if I renamed it (not semantic version). After discovering this, I planned to remove all older packages and just push the latest once that name was cleaned up. The GUI didn’t allow deletion of existing packages (also object reference exception). I removed the files manually from the Packages folder and ran a re-index:

Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object.
at Octopus.Server.Web.Api.ModelRestrictionMap.PackageUsages.<>c__DisplayClass1_0.b__2(PackageReference p) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Api\ModelRestrictionMap\PackageUsages.cs:line 30
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
at System.Linq.Enumerable.Any[TSource](IEnumerable1 source, Func2 predicate)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at System.Linq.Enumerable.<DistinctIterator>d__641.MoveNext()
at System.Linq.Buffer1..ctor(IEnumerable1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Octopus.Server.Web.Api.ModelRestrictionMap.PackageRestriction.CheckPermissionInProjects(IndexedPackage model, ISpacePartitionPrincipal principal, IOctopusQueryExecutor queryExecutor, Permission permissionToCheck) at Octopus.Server.Web.Infrastructure.Security.DocumentRestrictions.CompositeAndRestriction2.CombineWithAnd(Func2 check) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\DocumentRestrictions\CompositeAndRestriction.cs:line 44 at Octopus.Server.Web.Infrastructure.Security.DocumentRestrictions.CompositeAndRestriction2.CombineWithAnd(Func2 check) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\DocumentRestrictions\CompositeAndRestriction.cs:line 44 at Octopus.Server.Web.Infrastructure.Security.AccessChecker1.<>c__DisplayClass13_0.b__0() in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\AccessChecker.cs:line 161
at Octopus.Server.Web.Infrastructure.Security.AccessChecker1.CanDelete(TModel model) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\AccessChecker.cs:line 158 at Octopus.Core.Security.Permissions.AccessCheckerExtensions.AssertCanDelete[TModel](IAccessChecker1 accessChecker, TModel model) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\Security\Permissions\IAccessChecker.cs:line 39
at Octopus.Server.Web.Infrastructure.OctopusQueryExecutor.Delete[TDocument](TDocument instance, Nullable1 commandTimeout) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\OctopusQueryExecutor.cs:line 236 at Octopus.Core.BuiltInFeed.BuiltInPackageIndex.DeletePackage(IndexedPackage package) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\BuiltInFeed\BuiltInPackageIndex.cs:line 35 at Octopus.Core.BuiltInFeed.BuiltInPackageRepository.RemovePackage(IndexedPackage package, Func2 buildDeleteAuditEvent) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\BuiltInFeed\BuiltInPackageRepository.cs:line 223
at Octopus.Core.BuiltInFeed.BuiltInPackageRepository.<>c__DisplayClass17_0.b__1() in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\BuiltInFeed\BuiltInPackageRepository.cs:line 208
at System.Threading.Tasks.Task.Execute()
Octopus.Server version 2019.9.5 (2019.9.5+Branch.tags-2019.9.5.Sha.bbd39bbd6111cc9fc161af841722641afec2376d)

Currently looking a way to clean up this set of packages. Organization is currently using 2019.9.5 LTS

Hi David,
It looks like we’re addressing this in a duplicate support ticket. Let me know if I’m mistaken and can continue our conversation here.

Kind Regards,

Tina

Hi Tina,
that is accurate and your team has been in touch via email.

Thanks for checking

1 Like