Gas estimation on failed transactions - how to deal with it? [HARD]

I’m currently trying to estimate gas with ethersjs on a transaction on Ethereum (a swap) while I know this transaction will fail (because I don’t have enough funds) - how can I proceed to get an estimation while the transaction will fail? I know 1inch succeeds to do so.