# Getting \`to many arguments\` error while compiling contract

**URL:** <https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702>\
**Category:** Sway\
**Created:** [September 26, 2024, 5:27am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702 "2024-09-26T05:27:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevilAsap](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/devilasap/32/3588_2.png) [@DevilAsap](https://forum.fuel.network/u/DevilAsap)\
**Post date:** [September 26, 2024, 5:27am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/1 "2024-09-26T05:27:58Z")

</div>

- Fuel up show outuput

```auto
Default host: aarch64-apple-darwin
fuelup home: /Users/divy/.fuelup

Installed toolchains
--------------------
latest-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin (override)
testnet-aarch64-apple-darwin

active toolchain
----------------
nightly-aarch64-apple-darwin (override), path: /Users/divy/Developer/lync/Fuel-Contracts/nft_marketplace/fuel-toolchain.toml
  forc : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-client
      - forc-deploy : 0.63.6+nightly.20240923.1d50da1a4b
      - forc-run : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-crypto : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-debug : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-doc : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-fmt : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-lsp : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-tx : 0.63.6+nightly.20240923.1d50da1a4b
    - forc-wallet : 0.9.0+nightly.20240923.5c30466f2b
  fuel-core : 0.36.0+nightly.20240923.ca6a705bc2
  fuel-core-keygen : 0.35.0+nightly.20240909.a952ff44e0

```

- the read function which returns the Vector of Buyer struct is giving error

```auto
pub struct Buyer {
    pub buyer: Identity,
    pub quantity_bought: u64,
    pub buy_price_per_item: u64,
}

```

```auto
buyers: StorageMap<u64, StorageVec<Buyer>> = StorageMap {},

```

```auto
#[storage(read)]
    fn get_buyers(listing_id: u64) -> Vec<Buyer> {
        let mut buyers = Vec::new();

        if let storage_vec_key = storage.buyers.get(listing_id) {
            let len = storage_vec_key.len();
            let mut i = 0;
            while i < len {
                if let Some(storage_key) = storage_vec_key.get(i) {
                    buyers.push(storage_key.read());
                }
                i += 1;
            }
        }

        buyers
    }

```

- The Error I am getting

```auto
thread 'main' panicked at sway-core/src/asm_generation/fuel/functions.rs:121:30:
Too many arguments, cannot handle.: Immediate12TooLarge { val: 4467, span: Span { src (ptr): 0x11e009b90, source_id: None, start: 0, end: 0, as_str(): "" } }

```

---

<div class="post-metadata">

**Author:** ![DevilAsap](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/devilasap/32/3588_2.png) [@DevilAsap](https://forum.fuel.network/u/DevilAsap)\
**Post date:** [September 27, 2024, 11:01am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/2 "2024-09-27T11:01:10Z")

</div>

Could you please provide an estimated timeline for when this issue will be resolved?

---

<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:** [September 30, 2024, 10:28am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/3 "2024-09-30T10:28:19Z")

</div>

Hey @DevilAsap, can you please update the toolchain to the latest and see if the issue still persists? please make sure the forc version is `0.64.0` and fuel-core `0.36.0`

---

<div class="post-metadata">

**Author:** ![DevilAsap](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/devilasap/32/3588_2.png) [@DevilAsap](https://forum.fuel.network/u/DevilAsap)\
**Post date:** [September 30, 2024, 10:57am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/4 "2024-09-30T10:57:44Z")

</div>

- fuelup show output

```auto
Default host: aarch64-apple-darwin
fuelup home: /Users/divy/.fuelup

Installed toolchains
--------------------
latest-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default) (override)
testnet-aarch64-apple-darwin

active toolchain
----------------
nightly-aarch64-apple-darwin (override) (default), path: /Users/divy/Developer/lync/Fuel-Contracts/nft_marketplace/fuel-toolchain.toml
  forc : 0.64.0+nightly.20240930.6ba98da794
    - forc-client
      - forc-deploy : 0.64.0+nightly.20240930.6ba98da794
      - forc-run : 0.64.0+nightly.20240930.6ba98da794
    - forc-crypto : 0.64.0+nightly.20240930.6ba98da794
    - forc-debug : 0.64.0+nightly.20240930.6ba98da794
    - forc-doc : 0.64.0+nightly.20240930.6ba98da794
    - forc-fmt : 0.64.0+nightly.20240930.6ba98da794
    - forc-lsp : 0.64.0+nightly.20240930.6ba98da794
    - forc-tx : 0.64.0+nightly.20240930.6ba98da794
    - forc-wallet : 0.9.1+nightly.20240930.c49415c671
  fuel-core : 0.36.0+nightly.20240930.4a55b7de69
  fuel-core-keygen : 0.35.0+nightly.20240909.a952ff44e0

```

- This issue is still there

```auto
thread 'main' panicked at sway-core/src/asm_generation/fuel/functions.rs:121:30:
Too many arguments, cannot handle.: Immediate12TooLarge { val: 4920, span: Span { src (ptr): 0x158613c40, source_id: None, start: 0, end: 0, as_str(): "" } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

```

---

<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:** [September 30, 2024, 12:16pm UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/5 "2024-09-30T12:16:57Z")

</div>

Hey @DevilAsap Thanks for confirming. will make sure the team looks into it. Also, just for reference can you have a look at [here](https://forum.fuel.network/t/how-to-solve-compile-error-like-this/6358/3) and try the solution mentioned in there

---

<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:** [September 30, 2024, 12:27pm UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/6 "2024-09-30T12:27:53Z")

</div>

Also, can you please provide me a GitHub repo or gist for the entire codebase?

---

<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:** [October 2, 2024, 7:52am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/7 "2024-10-02T07:52:33Z")

</div>

@DevilAsap can you please provide codebase to reproduce the error?  
@xpluscal would be great to have a look at your codebase in the meanwhile

---

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [October 2, 2024, 10:19am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/8 "2024-10-02T10:19:45Z")

</div>

@naz3eh

> **[GitHub - Props-Labs/props-fuels at feature/mes-1577-add-extended-event-logs](https://github.com/Props-Labs/props-fuels/tree/feature/mes-1577-add-extended-event-logs)**
>
> feature/mes-1577-add-extended-event-logs

---

<div class="post-metadata">

**Author:** ![DevilAsap](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/devilasap/32/3588_2.png) [@DevilAsap](https://forum.fuel.network/u/DevilAsap)\
**Post date:** [October 2, 2024, 10:41am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/9 "2024-10-02T10:41:31Z")

</div>

mine is fixed , i changed listing id to u256 for the whole contract , and it fixed that error

---

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [October 3, 2024, 3:10am UTC](https://forum.fuel.network/t/getting-to-many-arguments-error-while-compiling-contract/6702/10 "2024-10-03T03:10:18Z")

</div>

> [@DevilAsap](#):
>
> u256

Interesting.

Our issue I think stems from the following contract change. We’re basically just trying to be able to return a Configurable Constant as we could not find any definition if that is possible or not. @naz3eh could you enlighten me?

Basically this is the change:

```auto
#[storage(read)]
    fn max_supply() -> Option<u64> {
        Some(MAX_SUPPLY)
    }

```

Max supply itself is defined like so:

```auto
MAX_SUPPLY: u64 = 3,

```
