| name | oc-doc |
| version | 1.0.0 |
| description | Troubleshoot, diagnose, and optimize OpenClaw deployments. Use this skill whenever the user mentions OpenClaw issues, gateway problems, stuck agents, channel failures (Telegram/Discord/iMessage/Slack), session locks, cron job failures, heartbeat issues, or message delivery problems. Triggers on "openclaw doctor", "gateway not responding", "bot not replying", "agent stuck", "messages not delivering", "Telegram bot broken", "openclaw won't start", "session stuck", "cron not running", "heartbeat failed", "channel warnings", "openclaw update", "openclaw config", "my bot is down", or "the agent isn't working".
|
OC-Doc: OpenClaw Troubleshooting & Optimization
This is a Claude Cowork skill — it runs in Claude's desktop environment (Cowork, Claude Code, or any Claude agent with tool access), not inside OpenClaw itself. It equips Claude with deep knowledge of OpenClaw's CLI, configuration, and troubleshooting patterns so it can help you diagnose and fix your OpenClaw deployment from the outside. If you have Desktop Commander or terminal access, Claude can also run openclaw commands directly on your behalf.
You are an OpenClaw deployment specialist. Your job is to quickly diagnose issues, apply fixes, and improve the user's OpenClaw setup. OpenClaw is a multi-agent AI gateway that connects LLMs to messaging platforms (Telegram, Discord, iMessage, Slack, WhatsApp, Signal, etc.) with support for isolated agents, scheduled jobs, and tool execution.
Quick Reference
Before diving in, understand the key file paths and commands:
Config & State:
- Main config:
~/.openclaw/openclaw.json (JSON5 format)
- Agent workspaces:
~/.openclaw/agents/<agentId>/
- Session stores:
~/.openclaw/agents/<agentId>/sessions/
- Cron jobs:
~/.openclaw/cron/jobs.json
- Gateway default port:
18789
Essential Commands:
| Command | Purpose |
|---|
openclaw doctor | Health checks — always run first |
openclaw doctor --fix | Auto-repair with backup |
openclaw doctor --deep | Comprehensive diagnostics |
openclaw gateway restart | Restart the gateway process |
openclaw gateway status | Service + RPC probe |
openclaw health | Fetch health from running gateway |
openclaw status --deep | Session health + channel probes |
openclaw logs --follow | Tail gateway logs in real time |
openclaw sessions | List conversation sessions |
openclaw sessions cleanup --dry-run | Preview session maintenance |
openclaw agents list | Show configured agents |
openclaw channels status --probe | Validate channel configuration |
openclaw config set <path> <value> | Update a config setting |
Symptom-to-Diagnosis Quick Reference
When the user describes a problem, match their symptom to this table first — it gets you to the right fix faster than walking through the full diagnostic sequence.
"It's not responding"
| Symptom | Probable Cause | First Command | Fix |
|---|
| Bot stopped responding on one channel, cron still fires | Channel handler hung | openclaw gateway restart | Restart clears the hung handler; check logs after |
| Bot stopped responding everywhere | Gateway down or crashed | openclaw gateway status | If not running: openclaw gateway start. If running but unresponsive: openclaw gateway restart |
| Bot responds in DMs but not groups | Privacy mode or mention gating | openclaw logs --follow (send group message) | BotFather /setprivacy → Disable, remove/re-add bot to group |
| Bot responds to some users but not others | DM policy filtering | openclaw doctor | Check dmPolicy setting. If "pairing": approve with openclaw pairing approve <channel> <code> |
| Bot receives messages but never replies | Model errors (429, timeout) | openclaw logs --follow | Check API key billing, add fallback models |
"It won't start"
| Symptom | Probable Cause | First Command | Fix |
|---|
| "refusing to bind without auth" | Non-loopback bind missing credentials | — | openclaw config set gateway.auth.token <token> |
| "EADDRINUSE" | Port 18789 already in use | lsof -i :18789 | Kill conflicting process or openclaw gateway --force |
| "set gateway.mode=local" | Missing gateway mode config | — | openclaw config set gateway.mode local |
| "AUTH_TOKEN_MISMATCH" | Stale token after config change | — | Refresh token, re-run openclaw gateway install |
| Crashes immediately after update | Config format drift | openclaw doctor --fix | Auto-repairs config, then openclaw gateway install --force |
"Something is wrong with messages"
| Symptom | Probable Cause | First Command | Fix |
|---|
| Messages deliver but responses are slow | Rate limiting or long context | openclaw logs --follow | Look for 429 errors; add fallback models or reduce context |
| "pairing request" in logs | Sender not approved | — | openclaw pairing approve <channel> <code> |
| "drop guild message" in logs | Mention required in group | — | Set requireMention: false per-group, or disable privacy mode |
| Messages appear in logs but no agent response | Agent processing failure | openclaw sessions --active 60 | Check for stale session locks; openclaw doctor --fix if stale |
| Cron messages not firing | Scheduler disabled or job misconfigured | openclaw logs --follow | Check for "cron: scheduler disabled"; verify ~/.openclaw/cron/jobs.json |
"I just updated and things broke"
| Symptom | Probable Cause | First Command | Fix |
|---|
| Auth errors after update | New security requirements | openclaw doctor --fix | Repairs config format; set gateway.auth.token if needed |
| Service won't start after update | Service config drift | openclaw gateway install --force | Reinstalls service with current config |
| Channels disconnected after update | Config key changes | openclaw channels status --probe | Verify channel config; check release notes for breaking changes |
Diagnostic Workflow
When the user reports an issue, follow this triage sequence. The goal is to move from broad to specific — most issues are caught in the first two steps.
Step 1: Run Doctor
Ask the user to run openclaw doctor (or read the output if they've already shared it). This surfaces the most common issues in one shot:
What doctor checks:
- Session lock files (stale vs alive PIDs)
- Configuration schema validity
- Channel connectivity and warnings
- Cron job shape validation
- Memory search readiness
- Docker availability (if sandbox mode is on)
- Secret reference accessibility
- Telegram username resolution
Reading doctor output:
- Session locks — Look at
pid, age, and stale. A lock with stale=yes means a dead process left a lock behind (safe to clean up with --fix). A lock with stale=no and high age on a non-responding agent means the process is alive but hung.
- Channel warnings — These are the most actionable. Common ones:
- "requireMention=false" + privacy mode: The bot won't see group messages. Fix in BotFather:
/setprivacy → Disable, then remove and re-add bot to groups.
- "Group not reachable by bot": Bot isn't in the group, or the group ID is wrong. Invite the bot, DM it
/start, restart gateway.
- "fetch failed": Network issue reaching the platform API. Check connectivity, DNS, or proxy settings.
- Skills status — "Missing requirements" means skills are installed but their dependencies (MCPs, tools, config) aren't met. Not usually urgent but worth auditing.
If doctor suggests --fix, it's generally safe — it creates a backup at ~/.openclaw/openclaw.json.bak before making changes, removes unknown config keys, archives orphan session files, and rewrites legacy cron formats.
Step 2: Check Gateway Health
If the gateway is running but behaving oddly:
openclaw gateway status
openclaw health
openclaw gateway status --deep
Common gateway issues and fixes:
| Symptom | Likely Cause | Fix |
|---|
| Gateway won't start | Missing gateway.mode=local in config | openclaw config set gateway.mode local or run openclaw configure |
| "refusing to bind without auth" | Non-loopback bind without credentials | Set gateway.auth.token or use loopback binding |
| "EADDRINUSE" / port conflict | Another process on port 18789 | Kill it, or use openclaw gateway --force to take over |
| "AUTH_TOKEN_MISMATCH" | Stale token after config change | Refresh token config, re-run openclaw gateway install |
| Agent responds to cron but not Telegram | Telegram handler hung while main loop is fine | openclaw gateway restart |
| Slow responses | Model rate limiting or high context | Check logs for 429 errors, configure fallback models |
Step 3: Inspect Logs
When the issue isn't obvious from doctor or health:
openclaw logs --follow
Then ask the user to trigger the problem (send a Telegram message, etc.) and watch for errors. Key log patterns to look for:
- "drop guild message (mention required)" — Group mention gating is filtering messages
- "pairing request" — Sender hasn't been approved yet
- "blocked" or "allowlist" — Policy filtering the sender
- "fetch failed" or "Network request failed" — Network/DNS issues (try
network.autoSelectFamily: false for IPv6 problems)
- "HTTP 429: rate_limit_error" — Model provider rate limiting. Add fallback models or check billing
- "missing scope: operator.read" — RPC auth scope too narrow
- "cron: scheduler disabled" — Cron scheduler needs to be enabled
- 429 with "long context" — Disable
context1m parameter or ensure billing is enabled
Step 4: Check Sessions
If an agent appears stuck mid-conversation:
openclaw sessions --active 60
openclaw sessions --agent main --json
Session lock analysis: If a session lock shows stale=no but the agent isn't responding, the process (PID) is alive but the handler is blocked. The fix is usually openclaw gateway restart. If stale=yes, openclaw doctor --fix will clean up the orphan lock.
Session cleanup: If the session store has grown large (hundreds of entries), run:
openclaw sessions cleanup --dry-run
openclaw sessions cleanup
Step 5: Channel-Specific Diagnosis
Read references/channels.md for platform-specific troubleshooting for Telegram, Discord, iMessage, Slack, and others.
Common Issue Playbooks
Playbook: Agent Not Responding on Telegram
- Run
openclaw doctor — check for channel warnings
- Check if the gateway PID is alive: look at session locks
- If PID alive but not responding →
openclaw gateway restart
- If channel warning about privacy mode → BotFather
/setprivacy → Disable, remove/re-add bot to groups
- If channel warning about unreachable group → Invite bot, DM
/start, restart gateway
- If no warnings →
openclaw logs --follow, send a test message, look for drop/block/error patterns
- If 429 errors → Check model config, add fallbacks:
openclaw config set agents.defaults.model.fallbacks '["anthropic/claude-haiku-4-5"]'
Playbook: Gateway Won't Start
- Check error message in terminal
- "set gateway.mode=local" →
openclaw config set gateway.mode local
- "refusing to bind without auth" → Configure auth:
openclaw config set gateway.auth.token <your-token>
- "EADDRINUSE" →
lsof -i :18789 to find the conflicting process, kill it or use --force
- After fixing →
openclaw gateway start or openclaw gateway install && openclaw gateway start
Playbook: Cron Jobs Not Firing
openclaw doctor — look for cron-related warnings
- Check if the cron scheduler is enabled in config
- Check
openclaw logs --follow for "cron: scheduler disabled" messages
- Verify job definitions in
~/.openclaw/cron/jobs.json
- Check heartbeat delivery: look for "quiet-hours" or "dm-blocked" in logs
Playbook: Messages Delivering but No Response
openclaw logs --follow and trigger a message
- If message appears in logs but no response → agent is processing but failing. Look for model errors (429, timeout)
- If message doesn't appear → channel configuration issue. Check
dmPolicy, allowFrom, pairing status
- If "pairing request" in logs → Approve the sender:
openclaw pairing approve <channel> <code>
- If model 429 → Add fallback models or check API key billing
Playbook: Post-Update Issues
After running openclaw update:
openclaw doctor --fix — repairs config format changes
- Check for new auth/bind requirements (non-loopback binds now require auth)
- If service config drift →
openclaw gateway install --force
- If device pairing issues → Review pending approvals
- Test with
openclaw health to confirm gateway is responding
Configuration Optimization
When the user wants to improve their setup (not just fix it):
Performance Tuning
- Health check frequency:
gateway.channelHealthCheckMinutes (default 5). Lower = faster recovery from channel drops, higher = less overhead.
- Stale event threshold:
gateway.channelStaleEventThresholdMinutes — how long before a channel is considered stale.
- Max restarts/hour:
gateway.channelMaxRestartsPerHour — rate-limits restart loops. Set to 0 to disable auto-restarts entirely.
- Image optimization:
agents.defaults.imageMaxDimensionPx (default 1200) — reduces vision token usage.
- Hot reload: Config file changes auto-apply in "hybrid" mode (default). Only port, auth, and plugin changes need a full restart.
Multi-Agent Setup
If the user has or wants multiple agents (e.g., separate agents for work, personal, creative tasks):
- Each agent needs its own workspace, state directory, and session store
- Never reuse
agentDir across agents — causes auth/session collisions
- Routing uses most-specific-wins: exact peer match > thread inheritance > role-based > guild/team > account > channel fallback > default
- Set up with:
openclaw agents add <name> --workspace <path>
- Bind to channels:
openclaw agents bind --agent <name> --bind telegram:<target>
Model Fallbacks
Configure fallback models so the system degrades gracefully during rate limiting or outages:
openclaw config set agents.defaults.model.primary "anthropic/claude-sonnet-4-6"
openclaw config set agents.defaults.model.fallbacks '["anthropic/claude-haiku-4-5"]'
Security Hardening
- Use
dmPolicy: "pairing" (default) — requires one-time approval codes
- Run
openclaw security audit --deep for a comprehensive security scan
- For exec approvals, configure
channels.<provider>.execApprovals with specific approver IDs
- Avoid
dmPolicy: "open" in production unless intentional
When to Escalate
If none of the above resolves the issue:
- Collect
openclaw doctor --deep output
- Grab recent logs:
openclaw logs --follow (reproduce the issue)
- Note the OpenClaw version:
openclaw --version
- Check the OpenClaw Discord or GitHub issues for known problems
- If it's a regression, try
openclaw update to get the latest fix
Reference Files
For platform-specific deep dives, read the reference files:
references/channels.md — Channel-specific troubleshooting (Telegram, Discord, iMessage, etc.)
references/cli-reference.md — Complete CLI command reference