# \`cargo test\` error: could not connect to fuel core server

**URL:** <https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679>\
**Category:** Rust SDK\
**Tags:** testnet, feedback, tutorials\
**Created:** [September 24, 2024, 12:10pm UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679 "2024-09-24T12:10:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adg0](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/adg0/32/3597_2.png) [@Adg0](https://forum.fuel.network/u/Adg0)\
**Post date:** [September 24, 2024, 12:10pm UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679/1 "2024-09-24T12:10:51Z")

</div>

I created a new counter contract and added Rust SDK as the documentation suggests.  
Then I am seeing this error message when I run `cargo test` on the default contract, how could I fix it?

```bash
$ cargo test
...
running 1 test
test can_get_contract_id ... FAILED

failures:

---- can_get_contract_id stdout ----
the exit status from the fuel binary was: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "Error: an error occurred while loading the chain state file: Some(\"/tmp/.tmp0NVqID/chain_config.json\")\n\nCaused by:\n unknown variant `V2`, expected `V1` at line 4 column 8\n" }, stdout: , stderr: Error: an error occurred while loading the chain state file: Some("/tmp/.tmp0NVqID/chain_config.json")

Caused by:
    unknown variant `V2`, expected `V1` at line 4 column 8

thread 'can_get_contract_id' panicked at tests/harness.rs:21:6:
called `Result::unwrap()` on an `Err` value: Other("could not connect to fuel core server")
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 1.55s

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

```

The steps I followed are:

```bash
$ forc new counter; cd counter

```

```bash
$ cargo generate --init fuellabs/sway templates/sway-test-rs --name counter --force

```

```bash
$ forc build

```

```bash
$ cargo test

```

---

<div class="post-metadata">

**Author:** ![nick](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/nick/32/2330_2.png) [@nick](https://forum.fuel.network/u/nick)\
**Post date:** [September 24, 2024, 12:14pm UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679/2 "2024-09-24T12:14:44Z")

</div>

Will look into this, thanks @Adg0

---

<div class="post-metadata">

**Author:** ![Adg0](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/adg0/32/3597_2.png) [@Adg0](https://forum.fuel.network/u/Adg0)\
**Post date:** [September 24, 2024, 12:21pm UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679/3 "2024-09-24T12:21:57Z")

</div>

Thanks @nick , I’m working on latest versions:

```auto
$ fuelup show

Default host: x86_64-unknown-linux-gnu
fuelup home: /home/USER/.fuelup

Installed toolchains
--------------------
latest-x86_64-unknown-linux-gnu (default)

active toolchain
----------------
latest-x86_64-unknown-linux-gnu (default)
  forc : 0.63.5
    - forc-client
      - forc-deploy : 0.63.5
      - forc-run : 0.63.5
    - forc-crypto : 0.63.5
    - forc-debug : 0.63.5
    - forc-doc : 0.63.5
    - forc-fmt : 0.63.5
    - forc-lsp : 0.63.5
    - forc-tx : 0.63.5
    - forc-wallet : 0.9.0
  fuel-core : 0.35.0
  fuel-core-keygen : 0.35.0

fuels versions
--------------
forc : 0.66.4
forc-wallet : 0.66.0

```

```auto
$ rustc --version
rustc 1.81.0 (eeb90cda1 2024-09-04)

```

---

<div class="post-metadata">

**Author:** ![alfiedotwtf](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/alfiedotwtf/32/3473_2.png) [@alfiedotwtf](https://forum.fuel.network/u/alfiedotwtf)\
**Post date:** [September 24, 2024, 10:03pm UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679/4 "2024-09-24T22:03:43Z")

</div>

Hey @Adg0,

Thanks for the report.

It looks like our documentation and published crates online are ahead of what Fuelup is using for fuel-core… your fuelup is currently showing 0.35.0 while [crates.io](http://crates.io) is at 0.36.0.

I’m not sure when, but we will be rolling out fuel-core to 0.36.0 soon which should get `cargo test` work again for you.

---

<div class="post-metadata">

**Author:** ![Adg0](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/adg0/32/3597_2.png) [@Adg0](https://forum.fuel.network/u/Adg0)\
**Post date:** [September 25, 2024, 9:46am UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679/5 "2024-09-25T09:46:56Z")

</div>

Thanks @alfiedotwtf

Until the `fuelup toolchain` updates, I used the `fuel-core` package for my system and it is running now.  
If someone else is having the same issue go to the packages on [`fuel-core`](https://github.com/FuelLabs/fuel-core/releases) repository uncompress the file and replace the binaries of `fuel-core` in your `fuelup toolchain`.

You will find the outdated `fuel-core` binaries here

```auto
~/.fuelup/toolchains/latest-x86_64-unknown-linux-gnu/bin

```

replace those with the new binaries from the latest package

```auto
fuel-core
fuel-core-keygen
fuel-core-wasm-executor.wasm

```

or simply change to nightly build, `fuelup toolchain install nightly`

---

<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:** [October 16, 2024, 5:47am UTC](https://forum.fuel.network/t/cargo-test-error-could-not-connect-to-fuel-core-server/6679/6 "2024-10-16T05:47:01Z")

</div>

Closed on October 16, 2024, 5:47am UTC

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