# Running \`fuels typegen\` command generates different contract factories each run

**URL:** <https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531>\
**Category:** TypeScript SDK\
**Created:** [August 27, 2024, 12:35pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531 "2024-08-27T12:35:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![martines3000](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/martines3000/32/3523_2.png) [@martines3000](https://forum.fuel.network/u/martines3000)\
**Post date:** [August 27, 2024, 12:35pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/1 "2024-08-27T12:35:14Z")

</div>

Versions used:

- fuels - 0.94.1
- toolchain channel `latest-aarch64-apple-darwin` (and tried with `nightly-2024-08-27`)
- forc - 0.63.1
- fuel-core - 0.34.0

The expected behavior is that the output of the typegen command should remain unchanged, provided that no modifications were made to the contracts’ abis.

---

<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:** [August 27, 2024, 12:55pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/2 "2024-08-27T12:55:31Z")

</div>

Thanks for sharing @martines3000, will make sure that the team looks into it

---

<div class="post-metadata">

**Author:** ![anderson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/anderson/32/320_2.png) [@anderson](https://forum.fuel.network/u/anderson)\
**Post date:** [August 27, 2024, 2:23pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/3 "2024-08-27T14:23:25Z")

</div>

@martines3000 Can you please provide a minimal contract and the commands you’re using so we can use them as a reproduction?

---

<div class="post-metadata">

**Author:** ![martines3000](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/martines3000/32/3523_2.png) [@martines3000](https://forum.fuel.network/u/martines3000)\
**Post date:** [August 27, 2024, 3:31pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/4 "2024-08-27T15:31:26Z")

</div>

I noticed the issue in this repository: [pyth-crosschain/target\_chains/fuel/contracts at main · pyth-network/pyth-crosschain · GitHub](https://github.com/pyth-network/pyth-crosschain/tree/main/target_chains/fuel/contracts)

I tested it with our contracts (the repository is currently private) and I had the same problem.  
@naz3eh Also tested it and had the same problem in the Pyth repository and I shared the abi and bin files of our contract with him on Telegram.

---

<div class="post-metadata">

**Author:** ![martines3000](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/martines3000/32/3523_2.png) [@martines3000](https://forum.fuel.network/u/martines3000)\
**Post date:** [August 27, 2024, 3:40pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/5 "2024-08-27T15:40:46Z")

</div>

I prepared the most basic example here: [GitHub - martines3000/fuel-ts-typegen-bug-repro](https://github.com/martines3000/fuel-ts-typegen-bug-repro)

I hope it helps.

---

<div class="post-metadata">

**Author:** ![p.s](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/p.s/32/2491_2.png) [@p.s](https://forum.fuel.network/u/p.s)\
**Post date:** [August 27, 2024, 4:41pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/6 "2024-08-27T16:41:36Z")

</div>

Hey @martines3000 👋

Thanks for the reproduction - I can see the issue you’re experiencing and identified a solution for this.

Will post back with progress.

---

<div class="post-metadata">

**Author:** ![martines3000](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/martines3000/32/3523_2.png) [@martines3000](https://forum.fuel.network/u/martines3000)\
**Post date:** [August 27, 2024, 4:42pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/7 "2024-08-27T16:42:34Z")

</div>

Awesome, thank you for the quick help. 💯

---

<div class="post-metadata">

**Author:** ![p.s](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/p.s/32/2491_2.png) [@p.s](https://forum.fuel.network/u/p.s)\
**Post date:** [August 27, 2024, 4:49pm UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/8 "2024-08-27T16:49:18Z")

</div>

Tracking the issue [here](https://github.com/FuelLabs/fuels-ts/issues/3039) 🙂

---

<div class="post-metadata">

**Author:** ![p.s](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/p.s/32/2491_2.png) [@p.s](https://forum.fuel.network/u/p.s)\
**Post date:** [August 28, 2024, 6:05am UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/9 "2024-08-28T06:05:13Z")

</div>

Hey @martines3000 👋

We’ve merged a [fix](https://github.com/FuelLabs/fuels-ts/pull/3040) for this issue now.

We’ll be looking to releasing this later today. You can use the `next` tag of `fuels` if this is a blocker for you in the meantime 🙂

---

<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:** [September 18, 2024, 2:05am UTC](https://forum.fuel.network/t/running-fuels-typegen-command-generates-different-contract-factories-each-run/6531/10 "2024-09-18T02:05:44Z")

</div>

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