Troubleshooting
Resolve the highest-frequency daemon failure patterns with deterministic recovery steps. For incidents outside this guide, inspect opta daemon logs first and escalate with the exact error trace.
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.
If another process owns the port, either stop that process or configure the daemon to use a different port range:
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 lmx-host.local: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
Check network connectivity
Check LMX has a model loaded
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
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.
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:
Use opta doctor --fix to attempt automatic fixes for common issues (stale state files, dead processes, missing config directories):
Log Analysis
The daemon log at ~/.config/opta/daemon/daemon.log is your primary debugging tool. Key patterns to look for:
Reset Everything
If targeted remediation fails, run a controlled full daemon reset. This sequence stops the daemon, clears daemon state artifacts, and starts a clean process while preserving session history.