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

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?

$ 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:

$ forc new counter; cd counter
$ cargo generate --init fuellabs/sway templates/sway-test-rs --name counter --force
$ forc build
$ cargo test

Will look into this, thanks @Adg0

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

$ 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
$ rustc --version
rustc 1.81.0 (eeb90cda1 2024-09-04)

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 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.

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 repository uncompress the file and replace the binaries of fuel-core in your fuelup toolchain.

You will find the outdated fuel-core binaries here

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

replace those with the new binaries from the latest package

fuel-core
fuel-core-keygen
fuel-core-wasm-executor.wasm

or simply change to nightly build, fuelup toolchain install nightly

1 Like

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