Trigger update return: Value cannot be null. Parameter name: source

Hi,

Everything I’m trying to update or delete a deployment trigger, I get this error:

Value cannot be null. Parameter name: source

It’s on Octopus Deploy version 2019.11.3

If I look in the audit I found this exception:

===================================================

Unhandled error on request: http://**********:81/api/Spaces-1/projecttriggers/ProjectTriggers-2 278d90927c174514b74e0fa3992c227a by : Value cannot be null.
Parameter name: source System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Octopus.Server.Web.Api.ModelRestrictionMap.ModelLoadTimeIdsGetter.ModelLoadTimeData(ProjectTrigger model) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Api\ModelRestrictionMap\ProjectTriggerRestrictionDefinition.cs:line 228 at Octopus.Server.Web.Api.ModelRestrictionMap.ProjectTriggerEnvironmentsRestriction.Validate(ProjectTrigger model, ISpacePartitionPrincipal principal, String vetoMsg, IOctopusQueryExecutor queryExecutor) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Api\ModelRestrictionMap\ProjectTriggerRestrictionDefinition.cs:line 73 at Octopus.Server.Web.Api.ModelRestrictionMap.ProjectTriggerEnvironmentsRestriction.CanDelete(ProjectTrigger model, ISpacePartitionPrincipal principal, IOctopusQueryExecutor queryExecutor) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Api\ModelRestrictionMap\ProjectTriggerRestrictionDefinition.cs:line 68 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 39 at Octopus.Server.Web.Infrastructure.Security.AccessChecker1.<>c__DisplayClass12_0.b__0() in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\AccessChecker.cs:line 150
at Octopus.Server.Web.Infrastructure.Security.AccessChecker1.CanDelete(TModel model) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Security\AccessChecker.cs:line 147 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 38
at Octopus.Core.Persistence.Indexes.DeleteCommand.DeleteRecursive(Func2 getExecutor, IDocument document, ReferenceCollection seenBefore, Boolean unrestricted) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\Persistence\Indexes\DeleteCommand.cs:line 48 at Octopus.Core.Persistence.Indexes.DeleteCommand.Delete(IOctopusQueryExecutor transaction, IDocument document) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Core\Persistence\Indexes\DeleteCommand.cs:line 39 at Octopus.Server.Web.Infrastructure.Api.CustomDeleteResponder3.ExecuteRegistered() in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Api\CustomDeleteResponder.cs:line 72
at Octopus.Server.Web.Infrastructure.Api.Responder1.Respond(TDescriptor options, NancyContext context) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 52 at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object o, CancellationToken x) in C:\buildAgent\work\abb2fbfce959a439\source\Octopus.Server\Web\Infrastructure\OctopusNancyModule.cs:line 125 at Nancy.Routing.Route1.d__7.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Nancy.Routing.DefaultRouteInvoker.d__2.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Nancy.Routing.DefaultRequestDispatcher.d__5.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Nancy.NancyEngine.d__22.MoveNext()

===================================================

Here the update request:

{“Id”:“ProjectTriggers-2”,“Name”:“Check Pods Dev”,“ProjectId”:“Projects-741”,“IsDisabled”:false,“Filter”:{“FilterType”:“CronExpressionSchedule”,“CronExpression”:“0 5 05-19 * * Mon-Fri”,“Timezone”:“Eastern Standard Time”,“Id”:null,“LastModifiedOn”:null,“LastModifiedBy”:null,“Links”:{}},“Action”:{“ActionType”:“DeployLatestRelease”,“Variables”:null,“SourceEnvironmentIds”:[“Environments-1”],“DestinationEnvironmentId”:“Environments-1”,“ShouldRedeployWhenReleaseIsCurrent”:true,“ChannelId”:null,“TenantIds”:[],“TenantTags”:[],“Id”:null,“LastModifiedOn”:null,“LastModifiedBy”:null,“Links”:{}},“SpaceId”:“Spaces-1”,“Description”:“Can’t update”,“Links”:{“Self”:"/api/Spaces-1/projecttriggers/ProjectTriggers-2",“Project”:"/api/Spaces-1/projects/Projects-741"}}

And the response:

{
“ErrorMessage”: “Value cannot be null.\r\nParameter name: source”
}

Thanks in advance.

Francis Grignon

One of our team member fix the issue by replacing this value in the database:

{"Filter":{"$type":"Octopus.Core.Model.Projects.ProjectTrigger.ScheduledTriggerFilters.CronScheduledTriggerFilter, Octopus.Core","Timezone":"Eastern Standard Time","CronExpression":"0 5 05-19 * * Mon-Fri","NextScheduledRun":"2020-01-10T10:05:00"},"Action":{"$type":"Octopus.Core.Model.Projects.ProjectTrigger.DeployLatestReleaseAction, Octopus.Core","SourceEnvironmentId":null,"DestinationEnvironmentId":"Environments-1","ChannelId":null,"TenantIds":[],"TenantTags":[],"Variables":null}}

to

{"Filter":{"$type":"Octopus.Core.Model.Projects.ProjectTrigger.ScheduledTriggerFilters.CronScheduledTriggerFilter, Octopus.Core","Timezone":"Eastern Standard Time","CronExpression":"0 7 05-19 * * Mon-Fri","NextScheduledRun":"2020-01-10T10:07:00"},"Action":{"$type":"Octopus.Core.Model.Projects.ProjectTrigger.DeployLatestReleaseAction, Octopus.Core","SourceEnvironmentIds":["Environments-2"],"DestinationEnvironmentId":"Environments-2","ChannelId":null,"TenantIds":[],"TenantTags":[],"Variables":null}}

The trigger was last updated in August. Maybe the structure did change since then.

Closing the ticket.