Updating Beagle and AgentNet
The update order that keeps your identity and friends, and the three things that go wrong when it is done in the wrong order.
September 2026Update in this order
Beagle is a UI. Your identity and your friends live in the AgentNet daemon (@decentnetwork/lan). Update the daemon first, restart it, then update Beagle, then start Beagle on the daemon. Done in another order, Beagle can come up on a fresh identity of its own and look like everything was lost.
# 1. update the network daemon first, and restart it
npm i -g @decentnetwork/lan@latest && agentnet restart
# 2. then update Beagle
npm i -g @decentnetwork/beagle@latest
# 3. restart Beagle ON the daemon (not on its own embedded peer)
beagle --backend daemon@decentnetwork/lan is the daemon: identity, friends, network. @decentnetwork/beagle is the chat UI on top of it. Updating one does not update the other.
Q: npm says EACCES and root-owned files in ~/.npm
npm error code EACCES
npm error path /Users/<you>/.npm/_cacache/tmp/...
npm error Your cache folder contains root-owned filesCause. An earlier sudo npm install -g wrote root-owned files into your own npm cache. Every later install without sudo trips over them. This is npm behaviour, not Beagle.
Fix, once: give the cache back to your user, then rerun the update.
sudo chown -R $(id -u):$(id -g) ~/.npmRunning the update itself under sudo makes it work today and leaves more root-owned files for next time. Fix the ownership instead — it is permanent.
Q: the desktop app says Setup could not finish (npm exited with code 1)
Same root cause as the EACCES above, in a different outfit. The desktop app installs into its own private folder and even brings its own Node — but npm's cache is shared by every npm on the machine, so the app's private install still trips over root-owned files in ~/.npm left by an earlier sudo npm. It is not caused by having AgentNet already installed.
sudo chown -R $(id -u):$(id -g) ~/.npm # then click Try againThe dialog only says npm exited with code 1. The actual reason is in the newest file under ~/.npm/_logs/ — it names the root-owned path and prints the exact chown command.
Q: file send failed with EACCES — is that the same problem?
No. It is a second root-owned-files problem in a different directory, and it has its own command. The two are easy to confuse because both say EACCES.
| Where it fails | Directory | Why root owns files there | Fix |
|---|---|---|---|
npm i -g ... | ~/.npm | An earlier sudo npm install -g wrote into your npm cache as root | sudo chown -R $(id -u):$(id -g) ~/.npm |
| Sending a file from the Beagle UI | ~/.agentnet | The daemon runs as root for the TUN device; older daemons created downloads/ and outbox/ files as root, and the UI, running as you, cannot write there | sudo agentnet fix-perms |
sudo agentnet fix-perms # repairs ~/.agentnet, no restart needed
sudo agentnet fix-perms --user alice # a tree that was chowned root by accidentCurrent daemons repair their own config dir at startup. fix-perms is for an install that predates that, or a daemon you cannot restart right now. It does not touch ~/.npm — for the npm cache, chown is still the answer.
Q: after the update my chat list is empty and my friends are gone
Nothing was lost. Beagle started before the daemon was back, could not find it, and quietly fell back to its own embedded peer — a brand-new identity with no friends. The first line Beagle prints tells you which one you got:
beagle 0.1.87 — backend: daemon (decentlan daemon at ~/.agentnet/carrier) ← what you want
beagle 0.1.87 — backend: embedded ← a fresh identity, no friendsFix: tell Beagle it must use the daemon. With --backend daemon it waits for the daemon instead of falling back. Then confirm the daemon itself still has everyone:
beagle --backend daemon # refuse to fall back; wait up to 60s for the daemon
beagle --backend daemon --wait-daemon 120
agentnet friends list # proves what the daemon itself holdsWithout --backend, Beagle picks daemon when it can reach one and embedded when it cannot. On a machine that runs the daemon, always pass --backend daemon — in the pm2 command too — so a slow daemon start can never silently swap your identity.
Q: Port 8766 is already in use
A previous Beagle is still running, and the one you just started exited without serving anything. The page you open on 8766 is the old one — often on the embedded backend, which is another way to end up staring at an empty chat list.
lsof -nP -iTCP:8766 -sTCP:LISTEN # who is holding it
kill <pid> && beagle --backend daemon # it was an old copy
beagle --backend daemon --port 8767 # or leave it, use another port
pm2 restart beagle-ui -- --backend daemon # if pm2 started itAll options
beagle --help prints everything. The ones that matter for updates:
| Option | What it does |
|---|---|
--backend daemon | Use the AgentNet daemon. Waits for it rather than falling back. |
--backend embedded | Run a standalone peer inside Beagle. A separate identity. |
--wait-daemon <s> | With daemon: how long to wait for it (default 60). |
--port <n> | HTTP port (default 8766). |
--config-dir <p> | Identity and config dir (default ~/.agentnet). |
--host <addr> | Bind address (default 127.0.0.1). Do not expose it to an untrusted LAN. |