# FuelError: Only one field must be provided

**URL:** <https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550>\
**Category:** TypeScript SDK\
**Tags:** testnet\
**Created:** [March 1, 2024, 1:41am UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550 "2024-03-01T01:41:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![poppyseedDev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/poppyseeddev/32/2369_2.png) [@poppyseedDev](https://forum.fuel.network/u/poppyseedDev)\
**Post date:** [March 1, 2024, 1:41am UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550/1 "2024-03-01T01:41:10Z")

</div>

I get the Only one field must be provided error when building with on top of the sway-applications. It happens when building the UI for the english-auction, when interacting with the create auction contract.

Code snippet:

```auto
const createAuction = async (
  multisigContract: AuctionContractAbi,
  bid_asset: AssetId,
  duration: BigNumberish,
  initial_price: BigNumberish,
  reserve_price: Option<BigNumberish>,
  seller: IdentityInput,
) => {
  try {
    const txResponse = await multisigContract.functions
    .create(
      bid_asset,
      10,
      1,
      0,
      seller
    )
    .callParams({
	  forward: [10, BaseAssetId],
	  gasLimit: 1,
	})
    .txParams({
      gasPrice: 1,
      gasLimit: 100_000,
    })
    .call();
    console.log('Auction created successfully', txResponse);
  } catch (error) {
  console.error('Failed to create auction:', error);
  }
}

```

> **[GitHub - poppyseedDev/sway-applications: Swaypplications](https://github.com/poppyseedDev/sway-applications)**
>
> Swaypplications. Contribute to poppyseedDev/sway-applications development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![poppyseedDev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/poppyseeddev/32/2369_2.png) [@poppyseedDev](https://forum.fuel.network/u/poppyseedDev)\
**Post date:** [March 1, 2024, 1:41am UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550/2 "2024-03-01T01:41:55Z")

</div>

Error:

```auto
bundle.js:336 Failed to create auction: FuelError: Only one field must be provided.
    at EnumCoder.encode (enum.ts:66:1)
    at tuple.ts:39:1
    at Array.map (<anonymous>)
    at TupleCoder.encode (tuple.ts:37:1)
    at FunctionFragment.encodeArguments (function-fragment.ts:121:1)
    at createContractCall (base-invocation-scope.ts:31:1)
    at base-invocation-scope.ts:86:1
    at Array.map (<anonymous>)
    at get calls (base-invocation-scope.ts:86:1)
    at FunctionInvocationScope.updateContractInputAndOutput (base-invocation-scope.ts:104:1)

```

---

<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:** [March 1, 2024, 11:26am UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550/3 "2024-03-01T11:26:42Z")

</div>

Hi @poppyseedDev,

So this is being thrown at `encodeArguments`, meaning that one of the parameters we are passing to `create` is being passed incorrectly. From the error we can also see it’s being thrown by the `EnumCoder`, so it must be thrown by a parameter expecting an enum value. From the ABI I can see that the seller parameter is the only one expecting an enum so the problem must be there.

Where you are building the seller parameter I can see you are passing two fields, and as the error explains, there should only be one. So:

```ts
    const seller: IdentityInput = { 
      Address: {
        value: wallet.address.toString(),
      },
      ContractId: {
        value: CONTRACT_ID,
      },
    };

```

should be

```ts
    const seller: IdentityInput = { 
      Address: {
        value: wallet.address.toB256(),
      },
    };

```

OR

```ts
    const seller: IdentityInput = { 
     ContractId: {
        value: CONTRACT_ID,
      },
    };

```

Please note, for address I’ve also used the `toB256()` function over `toString()` as we are expecting a b256 address here. `toString()` would give us bech32.

---

<div class="post-metadata">

**Author:** ![poppyseedDev](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/poppyseeddev/32/2369_2.png) [@poppyseedDev](https://forum.fuel.network/u/poppyseedDev)\
**Post date:** [March 1, 2024, 3:55pm UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550/4 "2024-03-01T15:55:25Z")

</div>

Hey, I fixed the values as mentioned however I still get the same exact error:

```auto

const createAuction = async (
  multisigContract: AuctionContractAbi,
  bid_asset: AssetId,
  duration: BigNumberish,
  initial_price: BigNumberish,
  reserve_price: Option<BigNumberish>,
  seller: IdentityInput,
) => {
  try {
    const txResponse = await multisigContract.functions
    .create(
      bid_asset,
      duration,
      initial_price,
      reserve_price,
      seller
    )
    .callParams({
	  forward: [10, BaseAssetId],
	  gasLimit: 1,
	})
    .txParams({
      gasPrice: 1,
      gasLimit: 100_000,
    })
    .call();
    console.log('Auction created successfully', txResponse);
  } catch (error) {
  console.error('Failed to create auction:', error);
  }
}

```

```auto
  const handleCreateAuction = async () => {
    if (!contract || !wallet) {
      alert("Contract not loaded or wallet not connected");
      return;
    }
    
    let bid_asset: AssetIdInput = {
      value: BaseAssetId,
    };

    const duration: BigNumberish = 10; 
    const initial_price: BigNumberish = 1; 
    const reserve_price: BigNumberish = 10; 
    const seller: IdentityInput = { 
      Address: {
        value: wallet.address.toB256(),
      },
      ContractId: {
        value: CONTRACT_ID,
      },
    };
    if (contract && wallet) {
      await createAuction(
        contract, 
        bid_asset, 
        duration, 
        initial_price, 
        reserve_price, 
        seller
      );
    }
  };

```

---

<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:** [March 1, 2024, 4:39pm UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550/5 "2024-03-01T16:39:59Z")

</div>

I can still see in your code that `seller` has 2 keys, `Address` AND `ContractId`. You must only use one, as the error states. `Address` OR `ContractId`. For example, please change `seller` to:

```ts
    const seller: IdentityInput = { 
      Address: {
        value: wallet.address.toB256(),
      },
    };

```

Please note I have run your code successfully with the above, I can push a PR if that is preferred.

---

<div class="post-metadata">

**Author:** ![Ran](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/ran/32/2417_2.png) [@Ran](https://forum.fuel.network/u/Ran)\
**Post date:** [March 24, 2024, 8:34am UTC](https://forum.fuel.network/t/fuelerror-only-one-field-must-be-provided/4550/6 "2024-03-24T08:34:37Z")

</div>

I got the same error and was able to resolve by adjusting some Address type values.
