Path exception when removing document in transaction

I am within a transaction trying to effectively rekey a document.

 var txResult = await tx.RunAsync(async context =>
                    {
                        var content = await context.GetOptionalAsync(collection, docInfo.DocId).ConfigureAwait(false);
                        if (content == default) return;
                        var cr = content.ContentAs<MyDto>();
                        await context.InsertAsync(collection, docInfo.RequestId, cr ).ConfigureAwait(false);
                      await context.RemoveAsync(content).ConfigureAwait(false);
                    });

And keep getting the following error on RemoveAsync :

      Couchbase.Transactions.Error.TransactionFailedException: Transaction failed.
       ---> Couchbase.Core.Exceptions.KeyValue.PathMismatchException: Exception of type 'Couchbase.Core.Exceptions.KeyValue.PathMismatchException' was thrown.
         at Couchbase.Core.ClusterNode.ExecuteOp(Func`4 sender, IOperation op, Object state, CancellationTokenPair tokenPair)
         at Couchbase.Core.ClusterNode.SendAsyncWithCircuitBreaker(IOperation op, CancellationTokenPair tokenPair)
         at Couchbase.CouchbaseBucket.SendAsync(IOperation op, CancellationTokenPair tokenPair)
         at Couchbase.Core.Retry.RetryOrchestrator.RetryAsync(BucketBase bucket, IOperation operation, CancellationTokenPair tokenPair)
         at Couchbase.KeyValue.CouchbaseCollection.MutateInAsync(String id, IEnumerable`1 specs, MutateInOptions options)
         at Couchbase.Transactions.DataAccess.DocumentRepository.MutateStagedRemove(TransactionGetResult doc, IAtrRepository atr)
         at Couchbase.Transactions.AttemptContext.CreateStagedRemove(TransactionGetResult doc, IRequestSpan parentSpan)
      -----------------------Context Info---------------------------
      {"DispatchedFrom":"","DispatchedTo":":11207","DocumentKey":"testkey","ClientContextId":"59","Cas":0,"Status":204,"BucketName":"test","CollectionName":"testthings","ScopeName":"poc","Message":"KV Error: {Name=\"SUBDOC_MULTI_PATH_FAILURE\", Description=\"Subdoc: Some (or all) commands failed. Inspect payload for details\", Attributes=\"subdoc,special-handling\"}","OpCode":"SubMultiMutation"}

         --- End of inner exception stack trace ---
         at Couchbase.Transactions.Transactions.RunAsync(Func`2 transactionLogic, PerTransactionConfig perConfig)
         at 
      -----------------------Context Info---------------------------
      null

Given that the RemoveAsync directly consumes the result of GetOptionalAsync, I am not sure what I am doing wrong here. Thoughts?

Hi Rentier.

That does look fine, to me, on first glance.

Transactions uses sub-doc APIs under the covers, so some of the errors that percolate up are subdoc errors.

Are you sure docInfo.DocId and docInfo.RequestId are different? context.RemoveAsync needs the TransactionGetResult from the most recent mutation, which would be the InsertAsync if they were the same.

What version of CouchbaseNetClient and Couchbase.Transactions are you using?