...as long as humans are involved in transactions (by writing software if anything), human errors seem to be bound to happen.
But as the article says, likely it happened via a script. But its a very costly mistake. I hope we know the real cause of it.
Overall, I like the depth the article has gone into. But I don't agree with this sentence:
the kind of script that swaps arguments by mistake may be the kind of script that does not write its keys out to a database, so the private keys may be long gone
I think the article got it wrong. How can the private key be lost (and also logged to DB!)? The 291+ btc would have come from some public key. If that that public key has got more btc attached to it, then the owner surely still has the private key. Also even if its zero value now. The wallet (public-key) from which the money came, would still exist, and private key still there somewhere.
So the miner can return the extra BTC to the same public key. Am I missing something?
This mistake is difficult, if not impossible, to make with standard Bitcoin software. The fee field is usually pre-filled and somewhat tricky to change, and newer versions of bitcoin-core will block transactions like this as obviously wrong. It should also be noted the bitcoin fees are implicit in transactions - a transaction will have some amount of funds going in, and some amount going out, and anything left over is the fee. Usually these types of mistakes actually happen when someone manually crafts a transaction and forgets that they need to make a change output for themselves.
It is obviously still possible to create transactions like this, but it currently requires using advanced interfaces and deliberately bypassing safety measures.