openclaw doctor
Diagnostic tool that checks system health and automatically repairs common issues.Usage
Options
Apply suggested fixes without prompting (non-interactive)
Run in non-interactive mode (equivalent to —fix)
Automatically generate and configure gateway token if missing
Show workspace improvement suggestions (default: true)
What Doctor Checks
The doctor command performs comprehensive system diagnostics:1. Configuration
- Config file validity - JSON5 syntax and schema validation
- Gateway configuration - Mode, port, bind, auth settings
- Legacy config migration - Detects and migrates deprecated settings
- Missing required fields - Ensures all required config is present
2. Authentication
- Gateway auth - Token/password configuration
- Auth profiles - Model provider credentials
- OAuth profiles - Anthropic/OpenAI OAuth status
- Deprecated profiles - Removes obsolete CLI auth profiles
3. Gateway Health
- Reachability - Can the gateway be reached?
- Service status - Is the daemon installed and running?
- Port conflicts - Is the port already in use?
- Daemon configuration - Service configuration validity
4. Channels
- Channel connectivity - Are channels reachable?
- Token validity - Are channel tokens configured correctly?
- Recent errors - Checks channel logs for issues
5. Workspace
- Directory existence - Is the workspace accessible?
- Bootstrap files - Are guide files present?
- Skills directory - Is skills structure correct?
- Memory system - Is memory search configured?
6. System Integration
- systemd lingering (Linux) - User session persistence
- LaunchAgent overrides (macOS) - Environment conflicts
- Shell completion - Command completion setup
- Path environment - Is openclaw on PATH?
7. State Integrity
- Session files - Session store validity
- Lock files - Stale lock detection and cleanup
- Legacy state - Old data migration
- Backup suggestions - Workspace backup reminders
8. Security
- Auth warnings - Insecure configurations
- Token exposure - Tokens in env/logs
- Bind warnings - Unsafe bind modes
- Sandbox scope - Container security settings
9. Updates
- Version check - Is an update available?
- Update channel - Current channel status
- UI protocol - Frontend/backend version compatibility
10. Docker/Sandbox
- Docker availability - Is Docker installed?
- Sandbox images - Are required images present?
- Image updates - Are images up to date?
Automatic Repairs
Doctor can automatically fix many issues:Config Repairs
- Migrate legacy configuration format
- Generate missing gateway token
- Fix gateway auth mode
- Update deprecated settings
- Repair malformed config
Auth Repairs
- Remove deprecated auth profiles
- Fix OAuth profile IDs
- Clear invalid session overrides
Gateway Repairs
- Repair daemon configuration
- Fix service install issues
- Regenerate gateway token
Workspace Repairs
- Create missing directories
- Install bootstrap files
- Fix skills structure
System Repairs
- Enable systemd lingering (Linux)
- Install shell completion
- Fix PATH configuration
Examples
Output Format
Doctor organizes findings into sections:Status Indicators
- ✓ (green) - Check passed
- ⚠ (yellow) - Warning, may need attention
- ✗ (red) - Error, requires action
Interactive Prompts
When run interactively, doctor prompts for repairs:- Y - Apply the fix
- n - Skip this fix
- Ctrl+C - Exit doctor
--fix to auto-accept all prompts.
Common Issues
Gateway Won’t Start
Symptoms:openclaw gateway startfails- Gateway not reachable
- Config validation
- Port conflicts (
lsof -i :18789) - Gateway auth configuration
- Daemon service status
Channel Not Working
Symptoms:- Messages not sending/receiving
- Channel shows offline
- Channel token validity
- Channel connectivity
- Recent channel errors
- Gateway health
Config Invalid
Symptoms:- Commands fail with config errors
- Gateway won’t start
- JSON5 syntax
- Schema validation
- Required fields
- Type checking
After Update Issues
Symptoms:- Commands fail after update
- Config incompatible
- Config schema version
- Legacy migrations
- UI protocol version
- Dependencies
systemd Service Stops (Linux)
Symptoms:- Gateway stops on logout
- Service not persistent
- User lingering status
- Service configuration
Exit Codes
- 0 - Doctor completed successfully
- 1 - Doctor found critical issues
- 2 - Doctor encountered errors
Scheduling
Run doctor periodically:Cron
systemd Timer
Create~/.config/systemd/user/openclaw-doctor.timer:
~/.config/systemd/user/openclaw-doctor.service:
Logs
Doctor operations are logged to:Migration Detection
Doctor detects and migrates:- Legacy session format - Old session file structure
- Old agent state - Pre-2026 agent configuration
- WhatsApp auth migration - Auth directory changes
- Config schema updates - Field renames/restructuring
Manual Migration
If automatic migration fails:Security Warnings
Doctor checks for security issues:Auth Mode None
Token in Logs
Unsafe Bind
Best Practices
- Run after install:
openclaw onboardthenopenclaw doctor - Run after updates:
openclaw updatethenopenclaw doctor - Run before reporting issues: Include doctor output in bug reports
- Run periodically: Weekly health checks recommended
- Review warnings: Don’t ignore yellow warnings

