# Cannot deploy a contract due to insufficient fee amount

**URL:** <https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401>\
**Category:** Rust SDK\
**Tags:** testnet, feedback\
**Created:** [May 29, 2024, 11:10am UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401 "2024-05-29T11:10:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [May 29, 2024, 11:10am UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/1 "2024-05-29T11:10:55Z")

</div>

By calling deploy function on the contract instance I was getting the following error:

```auto
Provider("io error: Response errors; Validity(InsufficientFeeAmount { expected: 2000000, provided: 1962467 })")

```

Even after providing tx policies with large limits, it didn’t help. The error is coming from some validation logic, where rust SDK fails to correctly estimate the fee amount it needs to provide for the transaction. And this logic ignores the provided tx policies

I resolved the issue by deploying the contract using `forc deploy`, but this should be fixed in the SDK as well. I can provide the bin and abi files of the contract if needed. Here’s the address of the contract on testnet (deployed via forc): `0x3faf84f2188b67d18055704b9001945a871fa24f86324761f630941eb6885ba5`

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [May 29, 2024, 12:51pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/2 "2024-05-29T12:51:15Z")

</div>

Hey @mpoplavkov, it seems to be related to an already open issue [here](https://github.com/FuelLabs/fuels-rs/issues/1361). However, there is a workaround for it [here](https://github.com/FuelLabs/fuels-rs/issues/1361#issuecomment-2134756575) that you can use and you will be unblocked by it.

---

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [May 29, 2024, 3:47pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/3 "2024-05-29T15:47:09Z")

</div>

That might be related indeed, but in my case - I’m trying to deploy the contract, not call its function. And as I mentioned, setting a high script gas limit doesn’t solve the issue in my case

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [May 29, 2024, 4:11pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/4 "2024-05-29T16:11:15Z")

</div>

Can you share your repo and the `forc` and `fuelup` versions you use?

---

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [May 29, 2024, 4:28pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/5 "2024-05-29T16:28:29Z")

</div>

## active toolchain

testnet-aarch64-apple-darwin (override)  
forc : 0.59.0  
- forc-client  
- forc-deploy : 0.59.0  
- forc-run : 0.59.0  
- forc-crypto : 0.59.0  
- forc-debug : 0.59.0  
- forc-doc : 0.59.0  
- forc-explore : 0.28.1  
- forc-fmt : 0.59.0  
- forc-lsp : 0.59.0  
- forc-tx : 0.59.0  
- forc-wallet : 0.7.1  
fuel-core : 0.26.0  
fuel-core-keygen : 0.26.0

## fuels versions

forc : 0.62.0  
forc-wallet : 0.62.0

---

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [May 29, 2024, 4:29pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/6 "2024-05-29T16:29:15Z")

</div>

I can’t share the repo but can give you the bin and abi files, which should be enough

---

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [May 29, 2024, 4:29pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/7 "2024-05-29T16:29:42Z")

</div>

fuelup --version  
fuelup 0.24.0

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/nick/32/2330_2.png) [@nick](https://forum.fuel.network/u/nick)\
**Post date:** [June 2, 2024, 3:51pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/8 "2024-06-02T15:51:44Z")

</div>

@mpoplavkov just following up here, was this issue resolved?

If it was, can you post how it was resolved?

---

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [June 3, 2024, 1:22pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/9 "2024-06-03T13:22:15Z")

</div>

No, it wasn’t. We’re still not able to deploy contracts using Rust SDK. We resolved it in a way that we used forc for the deployment

Even after upgrading to fuels-0.63.0 the following error persists:

```auto
Provider("io error: Response errors; InsufficientMaxFee { max_fee_from_policies: 188268, max_fee_from_gas_price: 188269 }")

```

Tx policies we’re using:

```rust
    TxPolicies::default()
        .with_max_fee(100_000_000)
        .with_script_gas_limit(4_000_000)
        .with_tip(1)
        .with_maturity(0)

```

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [June 3, 2024, 2:52pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/10 "2024-06-03T14:52:49Z")

</div>

Hey @mpoplavkov, i will look into it and get back to you soon

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/nick/32/2330_2.png) [@nick](https://forum.fuel.network/u/nick)\
**Post date:** [June 7, 2024, 3:07pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/11 "2024-06-07T15:07:29Z")

</div>

@naz3eh any followup here?

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [June 10, 2024, 3:28pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/12 "2024-06-10T15:28:41Z")

</div>

Hey @mpoplavkov, sorry for the delay. I coordinated with the team on this.  
So, the initial error was fixed by them upgrading to 0.63.0 from what I understand, and I was right to say that it is related to an open issue. the remaining problem with the `InsufficientMaxFee` will be fixed as part of the same issue. unfortunately, we can’t merge it right away because we need a PR to land in a release of fuel-core (that we will release it hopefully this week).  
TLDR; we have to wait for this release to get the PR for that issue to be merged.  
if your work is important and is being blocked by this currently, someone from the sdk can probably find a workaround for you. but I guess you’ve found it already with forc deploy.

Also, chances are you’re not applying the `TxPolicies` here correctly, since your error message says `max_fee_from_policies: 188268`, while you are setting a different amount judging from the snippet

> [@mpoplavkov](#):
>
> Tx policies we’re using:
> 
> ```auto
> TxPolicies::default()
> .with_max_fee(100_000_000)
> .with_script_gas_limit(4_000_000)
> .with_tip(1)
> .with_maturity(0)
> 
> ```

---

<div class="post-metadata">

**Author:** ![mpoplavkov](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/mpoplavkov/32/399_2.png) [@mpoplavkov](https://forum.fuel.network/u/mpoplavkov)\
**Post date:** [June 10, 2024, 3:40pm UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/13 "2024-06-10T15:40:35Z")

</div>

Hey, thanks for the response.

It’s not an issue for us since we’ve found a workaround indeed.

We’ve tried different tx policies, in the snippet above I just showed an example of policies much exceeding the required amounts.

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [June 11, 2024, 11:26am UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/14 "2024-06-11T11:26:24Z")

</div>

Thanks @mpoplavkov, I am glad it’s working for you. and yeah I did suspect tx policies as well 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex022/uploads/fuel/original/2X/5/57d5a345cc15a64b636e0d56e042857f8a0e80b1.png) [@system](https://forum.fuel.network/u/system)\
**Post date:** [July 11, 2024, 10:09am UTC](https://forum.fuel.network/t/cannot-deploy-a-contract-due-to-insufficient-fee-amount/5401/15 "2024-07-11T10:09:15Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
