Dfx nns install unusable

I started a clean local state with DFX and spinned NNS and dapp with dfx but, once logged in NNS dapp, the ICP account load forever and I’m unable to get ICP, which basically makes the test setting basically useless.

Can you fix the issue?

dfx start --clean
dfx extension uninstall nns
dfx extension install nns --version 0.4.1
dfx nns install

Open NNS dapp e.g. on http://qsgjb-riaaa-aaaaa-aaaga-cai.localhost:8080/


1 Like

Workaround: clean and reinstall the uterrly old version of NNS dapp.

dfx start --clean
dfx extension uninstall nns
dfx extension install nns
dfx nns install

It works for me using dfx v0.20.1, Ubuntu 22.04.4 LTS, Google Chrome Version 126.0.6478.126 (Official Build) (64-bit), and dfx extension install nns --version 0.4.1:

For completeness, here’s my networks.json:

$ cat ~/.config/dfx/networks.json 
{ 
  "local": { 
    "bind": "127.0.0.1:8080", 
    "type": "ephemeral", 
    "replica": { 
      "subnet_type": "system"
    } 
  } 
}

Thanks. I cleared the state for the zillion times and this time it worked out here as well. I guess the state went corrupted at some point.

Happened again. Might be because I started and quickly killed dfx start --clean - i.e. too slow and parts of the states is deleted but, other parts are still there.

It’s broken again! I definitely did not run any command like clean or whatsoever. I don’t know what’s happening, but there is definitely something fishy in that dfx nns setup.

Do you see some suspicious replica logs? Some errors in the browser console? Without a way to reproduce the error, it’d be close to impossible to fix it.

It happened again. It feels like every day when I come back to my project, this just crashes.

So, no logs in DFX / local replica, or at least nothing particular.

In the browser console, it’s Xmas:

index.d5b34e7a.js:4 
        
        
       GET http://127.0.0.1:51760/api/v2/status net::ERR_CONNECTION_REFUSED
window.fetch @ index.d5b34e7a.js:4
request @ vendor.1affbd98.js:27
e @ vendor.1affbd98.js:32
status @ vendor.1affbd98.js:27
fetchRootKey @ vendor.1affbd98.js:27
vv @ vendor.1affbd98.js:47
Wn @ index.d5b34e7a.js:6
tc @ index.d5b34e7a.js:15
Aj @ index.d5b34e7a.js:15
request @ index.d5b34e7a.js:15
m @ index.d5b34e7a.js:15
kn @ index.d5b34e7a.js:15
Hi @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
r @ index.d5b34e7a.js:4
o @ index.d5b34e7a.js:4
setCanisters @ index.d5b34e7a.js:15
Tj @ index.d5b34e7a.js:15
jj @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
c3 @ index.d5b34e7a.js:1
(anonymous) @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
W @ index.d5b34e7a.js:4
HNe @ index.d5b34e7a.js:6
ee @ index.d5b34e7a.js:4
_e @ index.d5b34e7a.js:4
await in _e (async)
te @ index.d5b34e7a.js:4
goto @ index.d5b34e7a.js:4
LNe @ index.d5b34e7a.js:6
(anonymous) @ main.js:11
Promise.then (async)
(anonymous) @ main.js:10
index.d5b34e7a.js:4 
        
        
       GET http://127.0.0.1:51760/api/v2/status net::ERR_CONNECTION_REFUSED
window.fetch @ index.d5b34e7a.js:4
request @ vendor.1affbd98.js:27
e @ vendor.1affbd98.js:32
status @ vendor.1affbd98.js:27
fetchRootKey @ vendor.1affbd98.js:27
vv @ vendor.1affbd98.js:47
Wn @ index.d5b34e7a.js:6
tc @ index.d5b34e7a.js:15
Aj @ index.d5b34e7a.js:15
request @ index.d5b34e7a.js:15
m @ index.d5b34e7a.js:15
kn @ index.d5b34e7a.js:15
Hi @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:16
DW @ index.d5b34e7a.js:16
k @ index.d5b34e7a.js:16
v @ index.d5b34e7a.js:16
(anonymous) @ index.d5b34e7a.js:16
KJ.s.$$.update @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
Z8 @ index.d5b34e7a.js:16
WJ @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
YJ @ index.d5b34e7a.js:16
Lt @ index.d5b34e7a.js:1
Z9 @ index.d5b34e7a.js:6
$e @ index.d5b34e7a.js:1
oq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
Vz @ index.d5b34e7a.js:15
W @ index.d5b34e7a.js:4
l_ @ index.d5b34e7a.js:15
lq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
eq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
YE @ index.d5b34e7a.js:13
W @ index.d5b34e7a.js:4
QE @ index.d5b34e7a.js:13
rq @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
os @ index.d5b34e7a.js:16
iq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
Dz @ index.d5b34e7a.js:15
$e @ index.d5b34e7a.js:1
FP @ index.d5b34e7a.js:13
$e @ index.d5b34e7a.js:1
tP @ index.d5b34e7a.js:13
W @ index.d5b34e7a.js:4
rP @ index.d5b34e7a.js:13
Lt @ index.d5b34e7a.js:1
zP @ index.d5b34e7a.js:13
W @ index.d5b34e7a.js:4
qP @ index.d5b34e7a.js:13
Bz @ index.d5b34e7a.js:15
W @ index.d5b34e7a.js:4
Er @ index.d5b34e7a.js:15
aq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
Rz @ index.d5b34e7a.js:15
W @ index.d5b34e7a.js:4
ol @ index.d5b34e7a.js:15
uq @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
fq @ index.d5b34e7a.js:16
Lt @ index.d5b34e7a.js:1
Y9 @ index.d5b34e7a.js:6
Q9 @ index.d5b34e7a.js:6
$e @ index.d5b34e7a.js:1
y1 @ index.d5b34e7a.js:15
p @ index.d5b34e7a.js:15
l9 @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
Promise.then (async)
k3 @ index.d5b34e7a.js:4
u9 @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:15
r @ index.d5b34e7a.js:4
sync @ index.d5b34e7a.js:6
await in sync (async)
Lj @ index.d5b34e7a.js:15
zj @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
c3 @ index.d5b34e7a.js:1
(anonymous) @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
W @ index.d5b34e7a.js:4
HNe @ index.d5b34e7a.js:6
ee @ index.d5b34e7a.js:4
_e @ index.d5b34e7a.js:4
await in _e (async)
te @ index.d5b34e7a.js:4
goto @ index.d5b34e7a.js:4
LNe @ index.d5b34e7a.js:6
(anonymous) @ main.js:11
Promise.then (async)
(anonymous) @ main.js:10
index.d5b34e7a.js:4 
        
        
       GET http://127.0.0.1:51760/api/v2/status net::ERR_CONNECTION_REFUSED
window.fetch @ index.d5b34e7a.js:4
request @ vendor.1affbd98.js:27
e @ vendor.1affbd98.js:32
status @ vendor.1affbd98.js:27
fetchRootKey @ vendor.1affbd98.js:27
vv @ vendor.1affbd98.js:47
Wn @ index.d5b34e7a.js:6
Nn @ index.d5b34e7a.js:14
F4 @ index.d5b34e7a.js:14
queryNeurons @ index.d5b34e7a.js:14
request @ index.d5b34e7a.js:15
m @ index.d5b34e7a.js:15
kn @ index.d5b34e7a.js:15
await in kn (async)
Gr @ index.d5b34e7a.js:15
LV @ index.d5b34e7a.js:15
g5 @ index.d5b34e7a.js:15
s.$$.update @ index.d5b34e7a.js:15
l9 @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
Promise.then (async)
k3 @ index.d5b34e7a.js:4
u9 @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:15
r @ index.d5b34e7a.js:4
sync @ index.d5b34e7a.js:6
await in sync (async)
Lj @ index.d5b34e7a.js:15
zj @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
c3 @ index.d5b34e7a.js:1
(anonymous) @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
W @ index.d5b34e7a.js:4
HNe @ index.d5b34e7a.js:6
ee @ index.d5b34e7a.js:4
_e @ index.d5b34e7a.js:4
await in _e (async)
te @ index.d5b34e7a.js:4
goto @ index.d5b34e7a.js:4
LNe @ index.d5b34e7a.js:6
(anonymous) @ main.js:11
Promise.then (async)
(anonymous) @ main.js:10
index.d5b34e7a.js:4 
        
        
       GET http://127.0.0.1:51760/api/v2/status net::ERR_CONNECTION_REFUSED
window.fetch @ index.d5b34e7a.js:4
request @ vendor.1affbd98.js:27
e @ vendor.1affbd98.js:32
status @ vendor.1affbd98.js:27
fetchRootKey @ vendor.1affbd98.js:27
vv @ vendor.1affbd98.js:47
Wn @ index.d5b34e7a.js:6
tc @ index.d5b34e7a.js:15
Pj @ index.d5b34e7a.js:15
Oj @ index.d5b34e7a.js:15
request @ index.d5b34e7a.js:15
m @ index.d5b34e7a.js:15
kn @ index.d5b34e7a.js:15
await in kn (async)
uo @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:16
DW @ index.d5b34e7a.js:16
k @ index.d5b34e7a.js:16
v @ index.d5b34e7a.js:16
(anonymous) @ index.d5b34e7a.js:16
KJ.s.$$.update @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
Z8 @ index.d5b34e7a.js:16
WJ @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
YJ @ index.d5b34e7a.js:16
Lt @ index.d5b34e7a.js:1
Z9 @ index.d5b34e7a.js:6
$e @ index.d5b34e7a.js:1
oq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
Vz @ index.d5b34e7a.js:15
W @ index.d5b34e7a.js:4
l_ @ index.d5b34e7a.js:15
lq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
eq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
YE @ index.d5b34e7a.js:13
W @ index.d5b34e7a.js:4
QE @ index.d5b34e7a.js:13
rq @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
os @ index.d5b34e7a.js:16
iq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
Dz @ index.d5b34e7a.js:15
$e @ index.d5b34e7a.js:1
FP @ index.d5b34e7a.js:13
$e @ index.d5b34e7a.js:1
tP @ index.d5b34e7a.js:13
W @ index.d5b34e7a.js:4
rP @ index.d5b34e7a.js:13
Lt @ index.d5b34e7a.js:1
zP @ index.d5b34e7a.js:13
W @ index.d5b34e7a.js:4
qP @ index.d5b34e7a.js:13
Bz @ index.d5b34e7a.js:15
W @ index.d5b34e7a.js:4
Er @ index.d5b34e7a.js:15
aq @ index.d5b34e7a.js:16
$e @ index.d5b34e7a.js:1
Rz @ index.d5b34e7a.js:15
W @ index.d5b34e7a.js:4
ol @ index.d5b34e7a.js:15
uq @ index.d5b34e7a.js:16
W @ index.d5b34e7a.js:4
fq @ index.d5b34e7a.js:16
Lt @ index.d5b34e7a.js:1
Y9 @ index.d5b34e7a.js:6
Q9 @ index.d5b34e7a.js:6
$e @ index.d5b34e7a.js:1
y1 @ index.d5b34e7a.js:15
p @ index.d5b34e7a.js:15
l9 @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
Promise.then (async)
k3 @ index.d5b34e7a.js:4
u9 @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:15
r @ index.d5b34e7a.js:4
sync @ index.d5b34e7a.js:6
await in sync (async)
Lj @ index.d5b34e7a.js:15
zj @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
c3 @ index.d5b34e7a.js:1
(anonymous) @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
W @ index.d5b34e7a.js:4
HNe @ index.d5b34e7a.js:6
ee @ index.d5b34e7a.js:4
_e @ index.d5b34e7a.js:4
await in _e (async)
te @ index.d5b34e7a.js:4
goto @ index.d5b34e7a.js:4
LNe @ index.d5b34e7a.js:6
(anonymous) @ main.js:11
Promise.then (async)
(anonymous) @ main.js:10
index.d5b34e7a.js:4 
        
        
       GET http://127.0.0.1:51760/api/v2/status net::ERR_CONNECTION_REFUSED
window.fetch @ index.d5b34e7a.js:4
request @ vendor.1affbd98.js:27
e @ vendor.1affbd98.js:32
status @ vendor.1affbd98.js:27
fetchRootKey @ vendor.1affbd98.js:27
vv @ vendor.1affbd98.js:47
Wn @ index.d5b34e7a.js:6
Yo @ index.d5b34e7a.js:14
Kp @ index.d5b34e7a.js:14
JO @ index.d5b34e7a.js:15
l5 @ index.d5b34e7a.js:15
request @ index.d5b34e7a.js:15
m @ index.d5b34e7a.js:15
kn @ index.d5b34e7a.js:15
await in kn (async)
i5 @ index.d5b34e7a.js:15
eV @ index.d5b34e7a.js:15
$Ne @ index.d5b34e7a.js:22
fB @ index.d5b34e7a.js:14
await in fB (async)
c @ index.d5b34e7a.js:15
s.$$.update @ index.d5b34e7a.js:15
l9 @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
Promise.then (async)
k3 @ index.d5b34e7a.js:4
u9 @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:4
(anonymous) @ index.d5b34e7a.js:15
r @ index.d5b34e7a.js:4
sync @ index.d5b34e7a.js:6
await in sync (async)
Lj @ index.d5b34e7a.js:15
zj @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
c3 @ index.d5b34e7a.js:1
(anonymous) @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
W @ index.d5b34e7a.js:4
HNe @ index.d5b34e7a.js:6
ee @ index.d5b34e7a.js:4
_e @ index.d5b34e7a.js:4
await in _e (async)
te @ index.d5b34e7a.js:4
goto @ index.d5b34e7a.js:4
LNe @ index.d5b34e7a.js:6
(anonymous) @ main.js:11
Promise.then (async)
(anonymous) @ main.js:10
qsgjb-riaaa-aaaaa-aaaga-cai.localhost/:1 Access to fetch at 'http://sgymv-uiaaa-aaaaa-aaaia-cai.localhost:8080/v1/sns/list/page/0/slow.json' from origin 'http://qsgjb-riaaa-aaaaa-aaaga-cai.localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
index.d5b34e7a.js:4 
        
        
       GET http://sgymv-uiaaa-aaaaa-aaaia-cai.localhost:8080/v1/sns/list/page/0/slow.json net::ERR_FAILED 500 (Internal Server Error)
window.fetch @ index.d5b34e7a.js:4
q5 @ index.d5b34e7a.js:15
oj @ index.d5b34e7a.js:15
querySnsProjects @ index.d5b34e7a.js:15
K5 @ index.d5b34e7a.js:15
jj @ index.d5b34e7a.js:15
(anonymous) @ index.d5b34e7a.js:15
c3 @ index.d5b34e7a.js:1
(anonymous) @ index.d5b34e7a.js:4
gn @ index.d5b34e7a.js:4
W @ index.d5b34e7a.js:4
HNe @ index.d5b34e7a.js:6
ee @ index.d5b34e7a.js:4
_e @ index.d5b34e7a.js:4
await in _e (async)
te @ index.d5b34e7a.js:4
goto @ index.d5b34e7a.js:4
LNe @ index.d5b34e7a.js:6
(anonymous) @ main.js:11
Promise.then (async)
(anonymous) @ main.js:10
index.d5b34e7a.js:15 Error converting data TypeError: Failed to fetch
    at window.fetch (index.d5b34e7a.js:4:9223)
    at q5 (index.d5b34e7a.js:15:67635)
    at oj (index.d5b34e7a.js:15:68050)
    at Object.querySnsProjects (index.d5b34e7a.js:15:68348)
    at K5 (index.d5b34e7a.js:15:68908)
    at jj (index.d5b34e7a.js:15:78230)
    at index.d5b34e7a.js:15:85386
    at c3 (index.d5b34e7a.js:1:1543)
    at Array.map (<anonymous>)
    at index.d5b34e7a.js:4:6596


Note that only NNS dapp and the ledger seems to have issues . My own project deployed with my own canister are just fine. Likewise for II.


Since http://127.0.0.1:51760/api/v2/status doesn’t work, it looks like the agent is trying to connect to a non-existing replica. Why does the agent not use the HTTP gateway port (8080)?

No clue.

That’s my dfx file: proposals.network/dfx.json at main · peterpeterparker/proposals.network · GitHub

Btw. those are the instruction to deploy and develop that particular project locally: proposals.network/HACKING.md at main · peterpeterparker/proposals.network · GitHub

The replica URL comes from here so you should make sure to not stop and start the replica after running dfx nns install, or even better pin the replica port:

$ cat ~/.config/dfx/networks.json 
{ 
  "local": { 
    "bind": "127.0.0.1:8080", 
    "type": "ephemeral", 
    "replica": { 
      "subnet_type": "system",
      "port": 8000
    } 
  } 
}

I’ll also fix the dfx nns extension, but this might take some time to get out, so pinning the replica port is the best short-term mitigation.

I’m not sure I understand what you mean. Are you implying that I should dfx start, then dfx nns install, and then never stop dfx again, otherwise it will lead to the issue?

Sure I can try that.

Well, that does not work at all.

❯ dfx start --clean
Running dfx start for version 0.20.0
Using project-specific network 'local' defined in /Users/daviddalbusco/projects/opensource/proposals.network/dfx.json
2024-07-09T19:27:56.684786Z ERROR icx_proxy_dev: Runtime crashed
Error: Runtime crashed

Caused by:
    0: fail to fetch root key for http://localhost:8000/
    1: An error happened during communication with the replica: error trying to connect: tcp connect error: Connection refused (os error 61)
2024-07-09T19:27:58.898450Z ERROR icx_proxy_dev: Runtime crashed
Error: Runtime crashed

Caused by:
    0: fail to fetch root key for http://localhost:8000/
    1: An error happened during communication with the replica: error trying to connect: tcp connect error: Connection refused (os error 61)
Initialized replica.
Dashboard: http://localhost:8000/_/dashboard
"networks": {
		"local": {
			"bind": "127.0.0.1:8080",
			"replica": {
				"subnet_type": "system",
				"port": 8000
			},
			"type": "ephemeral"
		}
	},

Don’t worry about the error messages, icx-proxy seems to be too eager, but eventually the connection is established.

Exactly! This is what I mean.

Thanks, I appreciate that you come up with a scenario but, it’s just not an option.

Ok, I’ll try again.

Correct. I redeployed. I let know if NNS dapp and its state get corrupted again.

Here’s the dfx extension fix: fix: use localhost:8080 in nns-dapp init args by mraszyk · Pull Request #129 · dfinity/dfx-extensions · GitHub

1 Like