# InvalidMetadataIdentifier when trying to retrieve user wallet in sway

**URL:** <https://forum.fuel.network/t/invalidmetadataidentifier-when-trying-to-retrieve-user-wallet-in-sway/4359>\
**Category:** Sway\
**Created:** [February 20, 2024, 1:04pm UTC](https://forum.fuel.network/t/invalidmetadataidentifier-when-trying-to-retrieve-user-wallet-in-sway/4359 "2024-02-20T13:04:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![YnT](https://avatars.discourse-cdn.com/v4/letter/y/91b2a8/32.png) [@YnT](https://forum.fuel.network/u/YnT)\
**Post date:** [February 20, 2024, 1:04pm UTC](https://forum.fuel.network/t/invalidmetadataidentifier-when-trying-to-retrieve-user-wallet-in-sway/4359/1 "2024-02-20T13:04:05Z")

</div>

I’m trying to create a very simple contract in which I want to return the user address but I’m struggling to understand the error message I receive, here is my contract:

```auto
contract;

use std::{
    auth::{
        AuthError,
        msg_sender,
    },
};

abi GetWallet {
    fn get_user_wallet() -> Address;
}

impl GetWallet for Contract {
    fn get_user_wallet() -> Address {
        let sender: Result<Identity, AuthError> = msg_sender();
        if let Identity::Address(address) = sender.unwrap() {
            address
        } else {
            revert(1);
        }
    }
}

```

I try to call the method from a test:

```auto

#[tokio::test]
async fn can_get_user_wallet() {
    let (instance, _id) = get_contract_instance().await;

    let result = instance.methods().get_user_wallet().call().await.unwrap();
}

```

But from here I got the following error:

```auto
---- can_get_user_wallet stdout ----
thread 'can_get_user_wallet' panicked at tests/harness.rs:42:68:
called `Result::unwrap()` on an `Err` value: RevertTransactionError { reason: "InvalidMetadataIdentifier", revert_id: 0, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: eb8692ce06ce1cf98ef679b29700cfdeff03d19254a080dfcd891baede402887, amount: 0, asset_id: 0000000000000000000000000000000000000000000000000000000000000000, gas: 40, param1: 755406600, param2: 0, pc: 11624, is: 11624 }, Panic { id: eb8692ce06ce1cf98ef679b29700cfdeff03d19254a080dfcd891baede402887, reason: PanicInstruction { reason: InvalidMetadataIdentifier, instruction: GTF { dst: 0x10, arg: 0x14, selector: 257 } (bytes: 61 41 41 01) }, pc: 12056, is: 11624, contract_id: None }, ScriptResult { result: Panic, gas_used: 224 }] }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

```

Am I doing something wrong? What does this error means exactly ?

If ever it helps, fuelup show result:

```auto
installed toolchains
--------------------
beta-4-x86_64-unknown-linux-gnu (default)
latest-x86_64-unknown-linux-gnu

active toolchain
----------------
beta-4-x86_64-unknown-linux-gnu (default)
  forc : 0.46.1
    - forc-client
      - forc-deploy : 0.46.1
      - forc-run : 0.46.1
    - forc-crypto : not found
    - forc-doc : 0.46.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.46.1
    - forc-lsp : 0.46.1
    - forc-tx : 0.46.1
    - forc-wallet : 0.3.0
  fuel-core : 0.20.5
  fuel-core-keygen : Error getting version string

fuels versions
--------------
forc : 0.45
forc-wallet : 0.45

```

---

<div class="post-metadata">

**Author:** ![theAusicist](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/theausicist/32/1987_2.png) [@theAusicist](https://forum.fuel.network/u/theAusicist)\
**Post date:** [February 20, 2024, 5:41pm UTC](https://forum.fuel.network/t/invalidmetadataidentifier-when-trying-to-retrieve-user-wallet-in-sway/4359/2 "2024-02-20T17:41:28Z")

</div>

try using the latest `Beta-5` toolchain: `fuelup toolchain install beta-5` and `fuelup default beta-5`. Had a similar issue; fixed on doing the above

---

<div class="post-metadata">

**Author:** ![YnT](https://avatars.discourse-cdn.com/v4/letter/y/91b2a8/32.png) [@YnT](https://forum.fuel.network/u/YnT)\
**Post date:** [February 21, 2024, 7:08pm UTC](https://forum.fuel.network/t/invalidmetadataidentifier-when-trying-to-retrieve-user-wallet-in-sway/4359/3 "2024-02-21T19:08:48Z")

</div>

Hey friend ! it works, thanks a lot 🙏

---

<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:** [March 13, 2024, 3:09pm UTC](https://forum.fuel.network/t/invalidmetadataidentifier-when-trying-to-retrieve-user-wallet-in-sway/4359/4 "2024-03-13T15:09:03Z")

</div>

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