# How to fix this error: The transaction contains a predicate which failed to validate

**URL:** <https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569>\
**Category:** TypeScript SDK\
**Created:** [May 8, 2023, 11:15pm UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569 "2023-05-08T23:15:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![elena](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@elena](https://forum.fuel.network/u/elena)\
**Post date:** [May 8, 2023, 11:15pm UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/1 "2023-05-08T23:15:08Z")

</div>

I’m trying to get a super simple example for predicates to work, where the predicate takes no arguments and returns true.

In the small frontend the predicate is loaded, funds are sent to the predicate and subsequently I try to spend the funds in the predicate. Although the predicate should return true always, I get an error that validation failed.

The full repo (minimal example): [GitHub - ewynx/predicate-practice-client1](https://github.com/ewynx/predicate-practice-client1)  
This is where I’m spending funds in the predicate (or at least that is the intention): [predicate-practice-client1/App.tsx at master · ewynx/predicate-practice-client1 · GitHub](https://github.com/ewynx/predicate-practice-client1/blob/master/frontend/src/App.tsx#L31)

Can someone tell me what I’m doing wrong or provide a working example?

---

<div class="post-metadata">

**Author:** ![danielbate](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/danielbate/32/1617_2.png) [@danielbate](https://forum.fuel.network/u/danielbate)\
**Post date:** [May 9, 2023, 1:33pm UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/2 "2023-05-09T13:33:48Z")

</div>

Hi @elena, thanks for reaching out.

I can see that you have not set a high enough gas limit for that transaction to succeed. With this, it is deemed invalid as [documented in the fuel specification](https://github.com/FuelLabs/fuel-specs/blob/a937dac06f6eda0905c2e3bcbee6038d39748b32/src/protocol/tx_format/transaction.md#transactionscript). I was able to get your example to succeed with a gas limit of 64.

---

<div class="post-metadata">

**Author:** ![elena](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@elena](https://forum.fuel.network/u/elena)\
**Post date:** [May 9, 2023, 4:34pm UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/3 "2023-05-09T16:34:05Z")

</div>

Thank you! This works.

---

<div class="post-metadata">

**Author:** ![timjay](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/timjay/32/1419_2.png) [@timjay](https://forum.fuel.network/u/timjay)\
**Post date:** [May 9, 2023, 9:50pm UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/4 "2023-05-09T21:50:53Z")

</div>

you can try to contact on discord

---

<div class="post-metadata">

**Author:** ![danielbate](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/danielbate/32/1617_2.png) [@danielbate](https://forum.fuel.network/u/danielbate)\
**Post date:** [May 10, 2023, 9:49am UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/5 "2023-05-10T09:49:52Z")

</div>

Discord is available yes, but a lot of information can get lost. The forum acts as a great source of truth in case others have the same problem.

---

<div class="post-metadata">

**Author:** ![danielbate](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/danielbate/32/1617_2.png) [@danielbate](https://forum.fuel.network/u/danielbate)\
**Post date:** [May 10, 2023, 9:57am UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/6 "2023-05-10T09:57:16Z")

</div>

Bit of additional information on the above also, may be helpful to yourself or others that land at this topic. The `transfer` function returns a `TransactionResponse` - [source code](https://github.com/FuelLabs/fuels-ts/blob/08130030a725d78ab4f7ca8919c3305a7f48b9ea/packages/providers/src/transaction-response/transaction-response.ts#L92-L100C11). This class has a `gasUsed` attribute that can be used to inform your `gasLimit` on the request.

---

<div class="post-metadata">

**Author:** ![elena](https://avatars.discourse-cdn.com/v4/letter/e/278dde/32.png) [@elena](https://forum.fuel.network/u/elena)\
**Post date:** [May 10, 2023, 3:48pm UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/7 "2023-05-10T15:48:27Z")

</div>

Thanks, that’s helpful 🙏

---

<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:** [May 31, 2023, 11:48am UTC](https://forum.fuel.network/t/how-to-fix-this-error-the-transaction-contains-a-predicate-which-failed-to-validate/2569/8 "2023-05-31T11:48:58Z")

</div>

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