Troubleshooting Guide¶
This guide helps you diagnose and fix common issues with Sleepless Agent.
Quick Diagnostics¶
Run these commands first to identify issues:
# Check system status
sle check
# Verify Claude Code CLI
claude --version
claude /usage
# Check daemon status
ps aux | grep "sle daemon"
# Review recent logs
tail -50 workspace/data/agent.log | grep ERROR
Common Issues¶
Agent Not Starting¶
Symptom¶
Solutions¶
-
Check Python version:
-
Verify dependencies:
-
Check workspace permissions:
-
Reset database:
Slack Bot Not Responding¶
Symptom¶
Slash commands don't trigger any response in Slack.
Solutions¶
- Verify Socket Mode:
- Go to Slack App settings
- Settings → Socket Mode → Should be ON
-
Regenerate app token if needed
-
Check tokens:
-
Test bot connection:
-
Restart bot:
Tasks Not Executing¶
Symptom¶
Tasks stay in "pending" status and never execute.
Solutions¶
-
Check Claude Code authentication:
-
Verify usage limits:
-
Check task status:
-
Force task execution:
Usage Threshold Reached¶
Symptom¶
Solutions¶
-
Check current usage:
-
Wait for window reset:
- Pro plan resets every 5 hours
-
Check logs for exact reset time
-
Adjust thresholds (if needed):
-
Clear completed tasks:
Database Locked¶
Symptom¶
Solutions¶
-
Stop all processes:
-
Check for hung processes:
-
Reset database (last resort):
Git Integration Issues¶
Symptom¶
Commits or PRs are not being created.
Solutions¶
-
Configure Git user:
-
Authenticate GitHub CLI:
-
Check repository configuration:
-
Test Git operations:
High Memory Usage¶
Symptom¶
Agent consuming excessive RAM.
Solutions¶
-
Check running tasks:
-
Clean up workspaces:
-
Limit concurrent tasks:
-
Restart daemon:
Tasks Failing¶
Symptom¶
Tasks consistently marked as "failed".
Solutions¶
-
Check error logs:
-
Increase timeout:
-
Test Claude Code directly:
-
Check workspace permissions:
Performance Issues¶
Slow Task Execution¶
-
Check system resources:
-
Optimize database:
-
Clear old logs:
Queue Backlog¶
-
View queue status:
-
Cancel stuck tasks:
-
Prioritize important tasks:
Log Analysis¶
Enable Debug Logging¶
Common Log Patterns¶
# Find authentication issues
grep -i "auth\|token\|login" workspace/data/agent.log
# Find task failures
grep "status.*failed" workspace/data/agent.log
# Find usage warnings
grep -i "usage\|threshold\|limit" workspace/data/agent.log
# Find Slack errors
grep -i "slack.*error" workspace/data/agent.log
Log Rotation¶
# Set up log rotation
cat > /etc/logrotate.d/sleepless-agent << EOF
workspace/data/agent.log {
daily
rotate 7
compress
delaycompress
notifempty
create 644 $USER $USER
}
EOF
System Checks¶
Health Check Script¶
Create health_check.sh:
#!/bin/bash
echo "=== Sleepless Agent Health Check ==="
echo
# Check daemon
if pgrep -f "sle daemon" > /dev/null; then
echo "✅ Daemon is running"
else
echo "❌ Daemon is NOT running"
fi
# Check Claude Code
if claude --version > /dev/null 2>&1; then
echo "✅ Claude Code CLI installed"
else
echo "❌ Claude Code CLI missing"
fi
# Check database
if [ -f "workspace/data/tasks.db" ]; then
echo "✅ Database exists"
TASK_COUNT=$(sqlite3 workspace/data/tasks.db "SELECT COUNT(*) FROM tasks;" 2>/dev/null)
echo " Total tasks: $TASK_COUNT"
else
echo "❌ Database missing"
fi
# Check Slack tokens
if [ -f ".env" ]; then
if grep -q "SLACK_BOT_TOKEN=xoxb" .env; then
echo "✅ Slack bot token configured"
else
echo "❌ Slack bot token missing"
fi
else
echo "❌ .env file missing"
fi
# Check disk space
WORKSPACE_SIZE=$(du -sh workspace 2>/dev/null | cut -f1)
echo "📊 Workspace size: $WORKSPACE_SIZE"
echo
echo "Run 'sle check' for detailed status"
Recovery Procedures¶
Complete Reset¶
# Backup current data
tar -czf workspace_backup.tar.gz workspace/
# Stop everything
pkill -f sleepless
pkill -f claude
# Clean workspace
rm -rf workspace/
rm .env
# Reinstall
pip install --upgrade sleepless-agent
# Reconfigure
sle init
cp .env.example .env
# Edit .env with your tokens
# Restart
sle daemon
Restore from Backup¶
# Stop daemon
pkill -f "sle daemon"
# Restore backup
tar -xzf workspace_backup.tar.gz
# Verify integrity
sqlite3 workspace/data/tasks.db "PRAGMA integrity_check;"
# Restart
sle daemon
Getting Help¶
If these solutions don't resolve your issue:
-
Collect diagnostic information:
-
Check existing issues:
-
Join the community:
-
Report new issue:
- Include diagnostic report
- Describe steps to reproduce
- Attach relevant log excerpts
Prevention Tips¶
- Regular maintenance:
- Clean old task workspaces weekly
- Archive completed tasks monthly
-
Rotate logs daily
-
Monitor resources:
- Set up disk space alerts
- Monitor memory usage
-
Track task success rates
-
Keep updated:
- Update Sleepless Agent regularly
- Update Claude Code CLI
-
Update dependencies
-
Backup important data:
- Database backups
- Configuration backups
- Result archives