Troubleshooting
Common daemon issues and their solutions. If you encounter a problem not listed here, check the daemon logs with opta daemon logs for detailed error messages.
Daemon Exits Immediately
If opta daemon start exits without error output, the most common cause is a port conflict.
Port in Use
The daemon tries to bind to port 9999. If that port is taken, it scans ports 10000 through 10020. If all ports are occupied, the daemon fails to start.
lsof -i :9999COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME node 12345 matt 22u IPv4 0x... 0t0 TCP localhost:9999 (LISTEN)
If another process owns the port, either stop that process or configure the daemon to use a different port range:
kill 12345 && opta daemon startopta daemon status to check whether it is a legitimate Opta daemon before killing it.WebSocket Drops
WebSocket connections can drop for several reasons. The most common is the LMX server becoming unreachable during inference.
LMX Unreachable
If the daemon cannot reach the LMX server at 192.168.188.11:1234, it will emit a turn.error event with code LMX_UNREACHABLE. The WebSocket connection itself stays open, but inference fails.
Check LMX is running
curl http://192.168.188.11:1234/healthz{"status":"ok"}Check network connectivity
ping -c 3 192.168.188.11Check LMX has a model loaded
curl http://192.168.188.11:1234/readyz{"ready":true,"model":"qwen3-30b-a3b"}192.168.188.11). Tailscale adds latency and is not supported for LMX connections.Permission Requests Hang
If a turn appears stuck, it may be waiting for a permission approval that was never resolved. This happens when a client disconnects while a permission.request event is pending.
To unblock the session:
Check for pending permissions
Connect to the WebSocket or poll events to find any unresolved permission.request events.
Cancel the stuck turn
curl -X POST http://127.0.0.1:9999/v3/sessions/SESSION_ID/cancel -H 'Authorization: Bearer TOKEN'Submit a new turn
After cancelling, you can submit a new turn to continue the conversation.
State File Corrupt
If the state file at ~/.config/opta/daemon/state.json becomes corrupt (e.g., due to a power loss during write), the CLI will fail to connect to the daemon.
Fix: delete the state file and restart the daemon.
rm ~/.config/opta/daemon/state.json && opta daemon startstate.json only removes the daemon process metadata (PID, token, port). Your session history is stored separately in ~/.config/opta/daemon/sessions/ and will not be affected.Crash Recovery
If the daemon crashes, the CLI automatically detects the stale state file on the next command. The ensureDaemonRunning crash guardian performs these steps:
- Reads the PID from
state.json - Sends a signal-zero check to verify the process is alive
- If the process is dead, removes the stale state file
- Spawns a new daemon with a fresh token
- Retries the original command
This happens transparently — in most cases, you will see a brief delay while the daemon restarts, then your command proceeds normally.
opta doctor
The opta doctor command runs a comprehensive diagnostic check across the entire Opta Local stack:
opta doctorChecking daemon... ● running (pid 12345, port 9999) Checking LMX... ● reachable (192.168.188.11:1234) Checking model... ● loaded (qwen3-30b-a3b) Checking config... ● valid Checking permissions... ● ok All checks passed.
Use opta doctor --fix to attempt automatic fixes for common issues (stale state files, dead processes, missing config directories):
opta doctor --fixLog Analysis
The daemon log at ~/.config/opta/daemon/daemon.log is your primary debugging tool. Key patterns to look for:
# Successful start
[10:00:01] INFO daemon started on 127.0.0.1:9999
# LMX connection failure
[10:00:05] ERROR lmx preflight failed: ECONNREFUSED 192.168.188.11:1234
# Permission timeout
[10:05:00] WARN permission request perm_001 timed out (5m), auto-denying
# OOM in tool worker
[10:10:00] ERROR tool worker crashed: heap out of memory
# Session directory creation race
[10:00:02] WARN session dir already exists, skipping mkdirReset Everything
As a last resort, you can perform a full daemon reset. This stops the daemon, removes all state files, and starts fresh. Session history is preserved.
opta daemon stoprm ~/.config/opta/daemon/state.json ~/.config/opta/daemon/daemon.logopta daemon start~/.config/opta/daemon/sessions/ directory contains all your persisted session data. Deleting it will permanently erase your conversation history.