# Error on "Counter" contract example

**URL:** <https://forum.fuel.network/t/error-on-counter-contract-example/2588>\
**Category:** Rust SDK\
**Created:** [May 10, 2023, 2:20pm UTC](https://forum.fuel.network/t/error-on-counter-contract-example/2588 "2023-05-10T14:20:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fuel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/fuel/32/1677_2.png) [@fuel](https://forum.fuel.network/u/fuel)\
**Post date:** [May 10, 2023, 2:20pm UTC](https://forum.fuel.network/t/error-on-counter-contract-example/2588/1 "2023-05-10T14:20:46Z")

</div>

Hi guys  
I was just doing an intro to development on SWAY for a friend and we ran into the following error in the counter project

```auto
cargo test (101) (*master+1) 14:58:33 
   Compiling counter-contract v0.1.0 (/Users/alexey/Desktop/fuel)
    Finished test [unoptimized + debuginfo] target(s) in 4.74s
     Running tests/harness.rs (target/debug/deps/integration_tests-ead747581303366b)

running 1 test
test can_get_contract_id ... FAILED

failures:

---- can_get_contract_id stdout ----
1e51522325399aec8bb52b7abf94d182f2dd12ab0c4a4d49ec3b476fa4d36a9f
thread 'can_get_contract_id' panicked at 'called `Result::unwrap()` on an `Err` value: RevertTransactionError { reason: "Revert", revert_id: 0, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: 1e51522325399aec8bb52b7abf94d182f2dd12ab0c4a4d49ec3b476fa4d36a9f, amount: 0, asset_id: 0000000000000000000000000000000000000000000000000000000000000000, gas: 1000000, param1: 1012642802, param2: 1, pc: 11624, is: 11624 }, Revert { id: 1e51522325399aec8bb52b7abf94d182f2dd12ab0c4a4d49ec3b476fa4d36a9f, ra: 0, pc: 11900, is: 11624 }, ScriptResult { result: Revert, gas_used: 341 }] }', tests/harness.rs:42:61
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    can_get_contract_id

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.25s

error: test failed, to rerun pass `--test integration_tests`

```

Code

> <https://github.com/PaulZhemanov/fuel/blob/forc-v0.41/src/main.sw>

Test

> <https://github.com/PaulZhemanov/fuel/blob/forc-v0.41/tests/harness.rs>

Repo

> **[GitHub - PaulZhemanov/fuel at forc-v0.41](https://github.com/PaulZhemanov/fuel/tree/forc-v0.41)**
>
> forc-v0.41

Can you help please?

---

<div class="post-metadata">

**Author:** ![maurice](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maurice](https://forum.fuel.network/u/maurice)\
**Post date:** [May 15, 2023, 6:42am UTC](https://forum.fuel.network/t/error-on-counter-contract-example/2588/2 "2023-05-15T06:42:06Z")

</div>

Hey Alex, looks to me like what we solved here: [Mismatched types - StorageKey\<u64\> - #14 by maurice](https://forum.fuel.network/t/mismatched-types-storagekey-u64/2498/14)

Let me know in case that doesn’t work for you 🙂

---

<div class="post-metadata">

**Author:** ![fuel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/fuel/32/1677_2.png) [@fuel](https://forum.fuel.network/u/fuel)\
**Post date:** [May 15, 2023, 11:08am UTC](https://forum.fuel.network/t/error-on-counter-contract-example/2588/3 "2023-05-15T11:08:10Z")

</div>

Thanks ser  
Will try 🫡

---

<div class="post-metadata">

**Author:** ![fuel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/fuel/32/1677_2.png) [@fuel](https://forum.fuel.network/u/fuel)\
**Post date:** [May 15, 2023, 1:19pm UTC](https://forum.fuel.network/t/error-on-counter-contract-example/2588/4 "2023-05-15T13:19:34Z")

</div>

Yes, That works, Thanks a lot \<3  
I have a question  
Why is the counter value None if we have declared the initial value here?

```auto
storage {   
    counter: u64 = 0,
}
 

```
