Can't stop dfx, "No local network replica found. Nothing to do." but is still running

dfx stop says “No local network replica found. Nothing to do.” but dfx canister status --all lists running containers and dfx deploy works…

Can’t stop the local network. Any hints to stop it?

1 Like

First you have to determine whether the path where you run the dfx stop command has the project’s dfx.json file. If not please go to the directory where the dfx.json file is located and execute the stop command.
If you are already in the working directory, then you can try to query the background process pid by lsof -i:8000 to find the pid of the process and then use kill -9 pid to end the process

1 Like

kill -9 *ID* will not help, because process automatically restarts by ics-proxy. Uninstall dfx → kill process → install dfx will helps (or OS restart).

1 Like

Yeah had to OS restart. Kinda freaked me out is this an open bug that the team is tracking or did I do something wrong?

I’m 100% sure I was in the same directory as the dfx.json file when executing dfx stop. Just looked at my terminal history to confirm.

lsof -i:8000 is a good idea to find the proc, my method was harder. I did find that the network was pretty persistent. Couldn’t manage to kill it off.

1 Like

Unfortunately, I don’t know if the Dfinity team knows about this bug or not.

This bug can be caught by performing dfx start --background twice without stopping (maybe in separated terminal sessions)

About fix: I can suggest the following:

  • you can open PR with fix in SDK Repo
  • or you can find corresponding github issue and add additional information
  • or you can create github issue with a detailed report and steps to reproduce
  • after that it is necessary to notify someone from Dfinity team (or wait for an answer on the github)

If you are blocked by this bug, you can temporarily use this solution

  • uninstall ~/.cache/dfinity/
  • find process lsof -i:8000
  • kill process kill -9 *pid*
  • install again sh -ci "$(curl -fsSL"