Two Brains Are Not Better Than One
If your Clawdbot sometimes works and sometimes doesn’t — duplicate replies, 502 after restart, “websocket disconnected”, or “the browser won’t start today” — you may not have a reliability problem. You may have a split brain.
Quick links
- Symptoms (what you see)
- Root cause (what’s actually happening)
- How to detect split-brain fast
- Fix (One-Brain migration pattern)
- Prevention (the standard)
Why this happens
Agent deployments are unusually sensitive to “state location.” A normal web app can be stateless and scale. Clawdbot usually can’t — it has auth state, message state, browser state, and long-lived sessions.
- Two users (root + non-root) ⇒ two different config/auth stores
- Two services (or manual runs + service) ⇒ port collisions + race conditions
- Two data dirs ⇒ transcript/PM/logs don’t match the process you’re debugging
Symptoms (what you see)
Split-brain is infamous because it looks like random flakiness. Common symptoms include:
- Duplicate replies (two gateways/processes responding to the same inbound message)
- 502 after restart (nginx points to a port that is now owned by a different process, or nothing)
- “Clawdbot websocket disconnected” loops (console ↔ gateway or client ↔ console)
- OAuth mismatch / “wrong account” behavior (the running process uses a different HOME/config than you expect)
- Headless automation works until reboot, then fails (Chrome profile / permissions / locks are in the other user’s directory)
Root cause (split state: root vs master, duplicated services)
“Two brains” usually means you have two independent Clawdbot installations on the same machine — or two processes that behave like it — each with their own state.
The most common shape
- You ran something manually as
rootduring install/testing. - Later you created a service user (e.g.
master) and ran systemd services there. - Now you have two sets of state:
/root/.clawdbotvs/home/master/.clawdbot(auth profiles/tokens/config)- two different
DATA_DIRtrees (PM/transcript/worklogs) - two processes competing for ports (gateway, console, browser debugging)
How to detect split-brain fast
You want to answer two questions: “Which process is running?” and “Which state is it using?”
1) Find duplicate listeners
ss -lntp
# Look for: two different PIDs holding the ports you expect
# or a port held by a process you didn’t intend to run.
2) Confirm the process owner (root vs master)
ps aux | egrep 'claw|node|gateway|console' | head
3) Confirm HOME/DATA_DIR at runtime
If you’re using systemd, inspect the unit file and ensure Environment=HOME=... and WorkingDirectory=... are explicit.
Fix (One-Brain migration pattern)
The fix is not “kill the weird process and hope.” The fix is a controlled migration to a single canonical brain.
Step 1: Choose your canonical brain
- Pick the service user that will own the system (commonly
master). - Pick the canonical HOME and canonical DATA_DIR.
Step 2: Stop everything (cleanly)
Use systemd to stop the known services. Then confirm ports are free. Avoid starting anything manually while migrating.
systemctl stop clawdbot-gateway
systemctl stop clawdconsole
ss -lntp
Step 3: Consolidate state
Goal: one set of config/auth profiles and one data directory. If you have two, decide which to keep and migrate the needed pieces.
- Auth/OAuth: ensure only one
.clawdbotdirectory is used by services. - Data: ensure only one
DATA_DIRis referenced in your service environment.
Step 4: Restart the canonical services
systemctl start clawdbot-gateway
systemctl start clawdconsole
Prevention (standard paths + services)
The goal is to make it impossible to accidentally start a second brain.
- Run gateway/console as one dedicated service user only.
- Set HOME + WorkingDirectory explicitly in systemd.
- Put durable data in one DATA_DIR that is backed up/snapshotted.
- Use a stable headless Chrome strategy (deb install + persistent
user-data-dir+ stable CDP port).
Get Early Access!
Hosted Clawdbot + ClawdConsole workspaces are coming very, very soon.
Join the waitlist and we’ll spin up your workspace the moment access opens.
- Same operator cockpit you’re seeing here
- Private hosted workspace
- We’ll email you your link when it’s ready