<p>The attached fee is too small. How are you creating your transactions? If you're using the cardano serialization lib <em>(from here <a href="https://github.com/Emurgo/cardano-serialization-lib" rel="nofollow noreferrer">https://github.com/Emurgo/cardano-serialization-lib</a>)</em> and you're using the <em>add_change_if_needed</em> function, call it right before building the tx to make sure it adds the right fee.</p>
<p>Often times while testing you can have single pure Ada UTXOs as inputs and outputs and when you go live you can get fragmented multiple UTXOs to cover the required sum with various assets attached etc., which can cause the fee to vary depending on the total tx size. Depending on the coin selection strategy the mechanism for choosing UTXOs can be random, which is why it only sometimes occurs.</p>

CC BY-SA 4.0
2022-05-18T08:04:02.067Z
Yes I used cardano serialization lib, and my add_change_if_needed is just right before building the tx
Eric Tsai
CC BY-SA 4.0
2022-05-18T08:06:41.557Z
txBuilder.add_change_if_needed(this.S.Address.from_bech32(PaymentAddress));
    const transaction = this.S.Transaction.new(
      txBuilder.build(),
      this.S.TransactionWitnessSet.new(),
      AUXILIARY_DATA
    );
Eric Tsai
CC BY-SA 4.0
2022-05-18T08:14:18.883Z
We calculate the fee and build the transaction in the frontend, then the backend sign and submit the tx, would that be the problem for the wrong tx fee?
Eric Tsai
CC BY-SA 4.0
2022-05-18T17:58:10.663Z
That should not be a problem. Creating a tx on the frontend and signing on the backend generally should be fine, but there seems to be a change in tx size happening somewhere, it could be somewhere in the cbor encoding / decoding processes. Maybe this helps: https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions/#a-note-on-fees
sean
CC BY-SA 4.0
2022-05-17T07:26:56.337Z
2022-05-17T07:26:56.337Z
sean
<p>Just set your fee to <code>272465</code> and resubmit the tx, then you should be fine</p>

CC BY-SA 4.0
2022-05-18T16:24:05.683Z
There are different utxo fee, if I just simply set to 272465, the tx exceeding 272465 will fail, unless I set it to 500000
Eric Tsai
CC BY-SA 4.0
2022-05-18T16:29:03.983Z
How are you building your transactions? Because if you're using the cardano cli you can let the cli calculate the fee instead of manually inputting it.

Same can be done using the cardano-serialization library
Will
CC BY-SA 4.0
2022-05-17T07:54:52.140Z
2022-05-17T07:54:52.140Z
Will
<p>we faced the utxo failure issue</p>
<p>the error message is like
message: '&quot;transaction submit error ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (FeeTooSmallUTxO (Coin 272465) (Coin 269165))))])&quot;',</p>
<p>What is the problem?
We tested many times successfully but the error only occurred when it went to mainnet</p>
<p>Here is our policy id if anyone could help look into the transaction and find out what the problem is?
<a href="https://cardanoscan.io/tokenPolicy/2fd5b51792a29d9c0f77297a29bbc262de093b1072f2fc17ee048a81" rel="nofollow noreferrer">https://cardanoscan.io/tokenPolicy/2fd5b51792a29d9c0f77297a29bbc262de093b1072f2fc17ee048a81</a></p>
<p>There are just part of the transactions failed, we want to know why</p>

<utxo>
utxo fail problem(utxo fee too small
# utxo fail problem(utxo fee too small

(Asked by: username_0 on 2022-05-17)

we faced the utxo failure issue

the error message is like
message: '"transaction submit error ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (FeeTooSmallUTxO (Coin 272465) (Coin 269165))))])"',

What is the problem?
We tested many times successfully but the error only occurred when it went to mainnet

Here is our policy id if anyone could help look into the transaction and find out what the problem is?
<https://cardanoscan.io/tokenPolicy/2fd5b51792a29d9c0f77297a29bbc262de093b1072f2fc17ee048a81>

There are just part of the transactions failed, we want to know why

**Tags:** utxo

---

## 2 answers

### Answer by username_1 on 2022-05-17. Score: 1

The attached fee is too small. How are you creating your transactions? If you're using the cardano serialization lib *(from here <https://github.com/Emurgo/cardano-serialization-lib>)* and you're using the *add\_change\_if\_needed* function, call it right before building the tx to make sure it adds the right fee.

Often times while testing you can have single pure Ada UTXOs as inputs and outputs and when you go live you can get fragmented multiple UTXOs to cover the required sum with various assets attached etc., which can cause the fee to vary depending on the total tx size. Depending on the coin selection strategy the mechanism for choosing UTXOs can be random, which is why it only sometimes occurs.

> **Comments:**
> **username_0**: Yes I used cardano serialization lib, and my add_change_if_needed is just right before building the tx  
> **username_0**: txBuilder.add_change_if_needed(this.S.Address.from_bech32(PaymentAddress));     const transaction = this.S.Transaction.new(       txBuilder.build(),       this.S.TransactionWitnessSet.new(),       AUXILIARY_DATA     );  
> **username_0**: We calculate the fee and build the transaction in the frontend, then the backend sign and submit the tx, would that be the problem for the wrong tx fee?  
> **username_1**: That should not be a problem. Creating a tx on the frontend and signing on the backend generally should be fine, but there seems to be a change in tx size happening somewhere, it could be somewhere in the cbor encoding / decoding processes. Maybe this helps: https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions/#a-note-on-fees  

---

### Answer by username_2 on 2022-05-17. Score: 0

Just set your fee to `272465` and resubmit the tx, then you should be fine

> **Comments:**
> **username_0**: There are different utxo fee, if I just simply set to 272465, the tx exceeding 272465 will fail, unless I set it to 500000  
> **username_2**: How are you building your transactions? Because if you're using the cardano cli you can let the cli calculate the fee instead of manually inputting it.  Same can be done using the cardano-serialization library  

---

