This is arguably a case of WiredTiger being too strict. We track whether any operation has "failed" during a transaction, with a fairly broad definition of failure. If an operation fails, any attempt to call WT_SESSION::commit_transaction will cause a rollback and return an error.
In the case of read-only transactions, this is a non-issue, because rollback and commit are equivalent. It seems like we should be able to relax the restriction and allow commit after failures in read-only transactions.