Error 251 - Transaction XXX has been aborted

Hi there, Even we faced this issue
I think we have solved it
We were using nodejs
we were using Promise.all with all our transactions,

let’s say
There are total of 10 transactions and you got error after 4 transactions, session.aborrtTransaction doesn’t work cause there are 6 more transactions in promise.all and there will be committed

You can do is
try {
// your code
}catch(e) {
await session.abortTransaction()
//This one line fixed our problem
await session.endSession
}