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?


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"

It seems like I have to stop the replica from the same terminal window where I started it. If I try to stop from any other terminal, it tells me that there is no local network replica found, and that there is nothing to do. Other tabs in the original terminal window (on MacOS terminal, anyway) are able to stop it, but not from another terminal window, or VSCode’s built-in terminal (unless dfx was started from there)

But if I go back to the terminal where I started dfx (or another tab from the same window), I’m able to stop it. After it is stopped, I (correctly, now) get the same message telling me it’s not running.

Screen Shot 2022-03-18 at 3.53.28 PM

Instead of having to keep track of which terminal I started dfx in, it would be nice if there was a way to stop dfx from any terminal, given that it’s a globally running process and I cannot start a second instance in any terminal:


Does anyone have a dfx killall macro that does not rely on uninstalling and then reinstalling dfx?

@Severin are there plans for a dfx killall or stop command from any terminal with the new global dfx?

Sometimes I’d like to easily stop my dfx server, but I have 10 projects running with different terminal different windows and I have no idea which one is running the DFX server.

No plans for now, but I added it as a feature request here.

We usually use killall dfx replica, but I haven’t had to use it in quite a while so I’m not sure how well it works with the global dfx.


Bump :slightly_smiling_face: 20 characters


Just ran into this again.