Getting error when trying to run 'dfx start --clean --background'

getting error while running dfx start --clean --background

Running dfx start for version 0.15.1
Using the default definition for the 'local' shared network because /home/akash/.config/dfx/networks.json does not exist.
  Version v0.15.1 installed successfully.
thread 'main' panicked at 'Error creating db for artifacts: Corrupted', rs/artifact_pool/src/lmdb_pool.rs:351:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'replica-actor' panicked at 'called `Result::unwrap()` on an `Err` value: Cannot start the replica: timed out', src/dfx/src/actors/replica.rs:393:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

also tried reinstalling dfx, but still the same error
tried with the latest dfx version too, but the error persist

Try upgrading to the latest version. 0.15 is quite far behind 0.24

still getting the same error

Running dfx start for version 0.24.1
Using the default configuration for the local shared network.
thread 'main' panicked at rs/artifact_pool/src/lmdb_pool.rs:446:39:
Error creating db for artifacts: Corrupted
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: An error happened during communication with the replica: error sending request for url (http://127.0.0.1:4943/api/v2/status)
Caused by: error sending request for url (http://127.0.0.1:4943/api/v2/status)
Caused by: client error (Connect)
Caused by: tcp connect error: Connection refused (os error 111)
Caused by: Connection refused (os error 111)

Are you running this on WSL? The replica is not built for WSL and regularly doesn’t work at all there.

Can you also try --pocketic? That uses PocketIC instead of the real replica

Yes, I’m running this on WSL on Windows.

I tried using --pocketic, but it also throws an error:

ERROR: Failed to initialize HTTP gateway: error sending request for url (http://localhost:63163/http_gateway): client error (Connect): tcp connect error: Connection refused (os error 111): Connection refused (os error 111)

Is there any other way to run this on Windows? Any alternative solutions or workarounds.

Not looking great TBH. If you are on WSL1 you can try it on WSL2 as well. That has much better chances at working.

@mraszyk do you know if PocketIC has any chance at working on WSL2?

WSL has a few broken APIs that otherwise are available on *nix. Some people occasionally get dfx start running in a docker container, but I don’t know of a currently working example.

Yes, I’ve successfully tested PocketIC to work in WSLv2.

1 Like

Hey, I tried to run the command in Linux based system, but still running into errors

┌──(kali㉿kali)-[~/Documents/hello]
└─$ dfx start --clean --background           
Running dfx start for version 0.24.1
Using the default configuration for the local shared network.
Error: An error happened during communication with the replica: error sending request for url (http://127.0.0.1:4943/api/v2/status)
Caused by: error sending request for url (http://127.0.0.1:4943/api/v2/status)
Caused by: client error (Connect)
Caused by: tcp connect error: Connection refused (os error 111)
Caused by: Connection refused (os error 111)

Could you try with a clean Ubuntu instance instead of Kali ?

I’m trying on ubuntu now, it is running i guess but when i try to open the url http://127.0.0.1:4943/ it’s showing canister_id_not_found

here;s the terminal

mrsky@mrsky-VirtualBox:~/Documents/hello$ dfx start --clean --background
Running dfx start for version 0.24.1
Using the default configuration for the local shared network.
Initialized replica.
Initialized HTTP gateway.
Replica API running on 127.0.0.1:4943

mrsky@mrsky-VirtualBox:~/Documents/hello$ dfx canister create --all
Creating canister mini-icp-backend...
Creating a wallet canister on the local network.
The wallet canister on the "local" network for user "default" is "bnz7o-iuaaa-aaaaa-qaaaa-cai"
mini-icp-backend canister created with canister id: bkyz2-fmaaa-aaaaa-qaaaq-cai
Creating canister mini-icp-frontend...
mini-icp-frontend canister created with canister id: bd3sg-teaaa-aaaaa-qaaba-cai

Makes sense. Try to open <frontend canister id>.localhost:4943 (as dfx deploy prints at the end). Then you should see something

@Severin
I encountered the same issue on macOS. It started working inexplicably once, but after shutting down the replica and restarting it the next day, the problem reappeared. I tried using --clean, --pocketic, and restarting the computer, but none of them worked.

➜  ~ dfx start --clean
Running dfx start for version 0.24.3
Using shared network 'local' defined in /Users/zensh/.config/dfx/networks.json
Initialized replica.
ERROR: Failed to initialize HTTP gateway: error sending request for url (http://localhost:49918/http_gateway): client error (Connect): tcp connect error: Connection refused (os error 61): Connection refused (os error 61)
ERROR: Failed to initialize HTTP gateway: error sending request for url (http://localhost:49921/http_gateway): client error (Connect): tcp connect error: Connection refused (os error 61): Connection refused (os error 61)
ERROR: Failed to initialize HTTP gateway: error sending request for url (http://localhost:49923/http_gateway): client error (Connect): tcp connect error: Connection refused (os error 61): Connection refused (os error 61)
ERROR: Failed to initialize HTTP gateway: error sending request for url (http://localhost:49925/http_gateway): client error (Connect): tcp connect error: Connection refused (os error 61): Connection refused (os error 61)