Getting null reafference exception from the at NServiceBus.Persistence.RavenDB.OutboxPersister.<SetAsDispatched>d__4.MoveNext()

so this is the issue i am struggling for a few days already.

we are running on AWS

now, recently we try moving our DB into a different VPC

When on the Same VPC all is good and working.

when an endpoint is on VPC 1 and DB on VPC 2 it is throwing some exceptions.

some specs:

NserviceBus Version 7.8 using NserviceBus Host

Raven Persistence 7

Raven Version is 6

i trying using Gemini for a few days

and the issue is that same message is being handed few times instead of only 1 time

First Exception is

2026-06-03 12:02:18.4239,12,Info,NServiceBus.RecoverabilityExecutor,Immediate Retry is going to retry message ‘aab5efbb-56d9-46ba-97d4-b45e00c6620a’ because of an exception:,“System.NullReferenceException Object reference not set to an instance of an object. at NServiceBus.Persistence.RavenDB.OutboxPersister.d__4.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 NServiceBus.TransportReceiveToPhysicalMessageConnector.d__1.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 NServiceBus.RetryAcknowledgementBehavior.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 NServiceBus.MainPipelineExecutor.d__1.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 NServiceBus.TransportReceiver.d__5.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NServiceBus.TransportReceiver.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 NServiceBus.Transport.Msmq.ReceiveStrategy.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 NServiceBus.Transport.Msmq.ReceiveOnlyNativeTransactionStrategy.d__2.MoveNext()”
2026-06-03 12:02:18.4396,18,Debug,NServiceBus.LoadHandlersConnector,"Processing message type: MaaS.Messages.MigrationPlan.IScheduleMigrationPlanMessage

second Exception is

026-06-03 12:02:18.5179,29,Info,NServiceBus.RecoverabilityExecutor,Immediate Retry is going to retry message ‘aab5efbb-56d9-46ba-97d4-b45e00c6620a’ because of an exception:,“Raven.Client.Exceptions.ClusterTransactionConcurrencyException Failed to execute cluster transaction due to the following issues: Guard compare exchange value ‘rvn-atomic/Outbox/MaaS.Backend.Scheduler/aab5efbb-56d9-46ba-97d4-b45e00c6620a’ index does not match the transaction index’s 0 change vector on Outbox/MaaS.Backend.Scheduler/aab5efbb-56d9-46ba-97d4-b45e00c6620a
Concurrency check failed for putting the key ‘rvn-atomic/Outbox/MaaS.Backend.Scheduler/aab5efbb-56d9-46ba-97d4-b45e00c6620a’. Requested index: 0, actual index: 22505147 at Raven.Client.Exceptions.ExceptionDispatcher.ThrowConflict(ExceptionSchema schema, BlittableJsonReaderObject json)
at Raven.Client.Exceptions.ExceptionDispatcher.d__3.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 Raven.Client.Http.RequestExecutor.d__1391.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 Raven.Client.Http.RequestExecutor.<ExecuteAsync>d__1151.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Raven.Client.Http.RequestExecutor.d__115`1.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 Raven.Client.Documents.Session.AsyncDocumentSession.d__32.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 NServiceBus.TransportReceiveToPhysicalMessageConnector.d__1.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 NServiceBus.RetryAcknowledgementBehavior.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 NServiceBus.MainPipelineExecutor.d__1.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 NServiceBus.TransportReceiver.d__5.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NServiceBus.TransportReceiver.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 NServiceBus.Transport.Msmq.ReceiveStrategy.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 NServiceBus.Transport.Msmq.ReceiveOnlyNativeTransactionStrategy.d__2.MoveNext()”
2026-06-03 12:02:18.5179,31,Debug,NServiceBus.LoadHandlersConnector,"Processing message type: MaaS.Messages.MigrationPlan.IScheduleMigrationPlanMessage