Files
ruflo/docs/integration/troubleshooting-guide.md
T
rUv 9381ac89df fix: update all documentation to use correct MCP tool references
- Replace all instances of mcp__ruv-swarm__ with mcp__claude-flow__
- Fix tool references in CLAUDE.md and all command documentation
- Update integration guides and workflow patterns
- Ensure consistent MCP tool naming across all docs

Fixes #160
2025-07-09 20:06:09 +00:00

847 lines
19 KiB
Markdown

# Claude Flow v2.0.0 - Comprehensive Troubleshooting Guide
## 🎯 Overview
This comprehensive troubleshooting guide addresses common issues, performance problems, and integration challenges with Claude Flow v2.0.0, including ruv-swarm coordination, neural networks, memory management, and enterprise deployment.
## 📋 Quick Diagnostic Commands
### System Health Check
```bash
# Complete system diagnostics
npx claude-flow@2.0.0 health-check --comprehensive
# Check all integrations
npx claude-flow@2.0.0 diagnostic run --components "swarm,neural,memory,mcp"
# Verify MCP tools
claude mcp status ruv-swarm
claude mcp test ruv-swarm
# Check neural networks
npx claude-flow@2.0.0 neural status --detailed
```
### Performance Analysis
```bash
# Performance overview
npx claude-flow@2.0.0 performance report --timeframe 24h --format detailed
# Identify bottlenecks
npx claude-flow@2.0.0 bottleneck analyze --all-components
# Memory analysis
npx claude-flow@2.0.0 memory analytics --real-time
```
---
## 🐝 Swarm Coordination Issues
### Issue 1: Agents Not Spawning
**Symptoms:**
- Agent spawn commands timeout
- No agents listed in swarm status
- Error: "Failed to initialize agent coordination"
**Diagnosis:**
```bash
# Check swarm initialization
npx claude-flow@2.0.0 swarm status --verbose
# Verify coordination hooks
npx ruv-swarm hook pre-task --test
npx ruv-swarm hook post-edit --test
# Check MCP connectivity
claude mcp status ruv-swarm
```
**Solutions:**
```bash
# Solution 1: Reset swarm completely
npx claude-flow@2.0.0 swarm destroy --force --all
npx claude-flow@2.0.0 coordination swarm-init --topology mesh --max-agents 8
# Solution 2: Clear coordination cache
rm -rf ./memory/coordination-cache/
npx claude-flow@2.0.0 coordination sync --force
# Solution 3: Restart MCP server
claude mcp restart ruv-swarm
# Solution 4: Check permissions
chmod +x node_modules/.bin/ruv-swarm
npm install -g ruv-swarm@1.0.14 --force
```
**Prevention:**
- Always verify MCP server status before spawning agents
- Use `--test-mode` flag during development
- Monitor coordination memory usage regularly
### Issue 2: Poor Coordination Performance
**Symptoms:**
- High task completion times
- Low parallel execution rates
- Agents frequently idle or blocked
**Diagnosis:**
```bash
# Analyze coordination metrics
npx claude-flow@2.0.0 agent metrics --all
npx claude-flow@2.0.0 coordination sync --analyze
# Check task distribution
npx claude-flow@2.0.0 task status --detailed
```
**Solutions:**
```bash
# Solution 1: Optimize topology
npx claude-flow@2.0.0 topology optimize --swarm-id current
# Solution 2: Adjust agent allocation
npx claude-flow@2.0.0 load balance --strategy adaptive
# Solution 3: Clear memory bottlenecks
npx claude-flow@2.0.0 memory compress --ratio 0.8
npx claude-flow@2.0.0 memory backup --cleanup-old
# Solution 4: Tune batch operations
export CLAUDE_BATCH_SIZE=16
export CLAUDE_PARALLEL_LIMIT=8
```
### Issue 3: Memory Sync Failures
**Symptoms:**
- Agents lose context between tasks
- Inconsistent memory states across agents
- Error: "Memory synchronization timeout"
**Diagnosis:**
```bash
# Check memory sync status
npx claude-flow@2.0.0 memory sync --status
npx claude-flow@2.0.0 swarm monitor --memory-focus
# Analyze sync performance
npx claude-flow@2.0.0 memory analytics --sync-metrics
```
**Solutions:**
```bash
# Solution 1: Force memory synchronization
npx claude-flow@2.0.0 memory sync --force --all-agents
# Solution 2: Rebuild memory index
npx claude-flow@2.0.0 memory usage --action rebuild-index
# Solution 3: Increase sync timeout
export MEMORY_SYNC_TIMEOUT=60000 # 60 seconds
# Solution 4: Clean corrupted entries
npx claude-flow@2.0.0 memory usage --action cleanup --corrupted-only
```
---
## 🧠 Neural Network Issues
### Issue 1: WASM Module Loading Failures
**Symptoms:**
- Error: "WebAssembly module compilation failed"
- Neural networks show as "NOT LOADED"
- Training commands fail immediately
**Diagnosis:**
```bash
# Check WebAssembly support
node -e "console.log('WASM support:', typeof WebAssembly !== 'undefined')"
# Validate WASM module
ls -la node_modules/ruv-swarm/dist/neural/
file node_modules/ruv-swarm/dist/neural/claude-flow-neural.wasm
wasm-validate node_modules/ruv-swarm/dist/neural/claude-flow-neural.wasm
# Check for corruption
shasum -a 256 node_modules/ruv-swarm/dist/neural/claude-flow-neural.wasm
```
**Solutions:**
```bash
# Solution 1: Reinstall with WASM support
npm uninstall -g ruv-swarm
npm install -g ruv-swarm@1.0.14 --build-from-source
# Solution 2: Clear neural cache
rm -rf ./memory/neural-cache/
npx claude-flow@2.0.0 neural train --reset-cache
# Solution 3: Download fresh WASM module
curl -L https://github.com/ruvnet/ruv-FANN/releases/latest/download/claude-flow-neural.wasm \
-o node_modules/ruv-swarm/dist/neural/claude-flow-neural.wasm
# Solution 4: Use Node.js with WASM support
node --experimental-wasm-modules --experimental-wasm-bigint
```
### Issue 2: Training Performance Issues
**Symptoms:**
- Extremely slow training times
- High memory usage during training
- Training accuracy not improving
**Diagnosis:**
```bash
# Check training performance
npx claude-flow@2.0.0 neural status --training-metrics
npx claude-flow@2.0.0 benchmark run --category neural
# Monitor resource usage
npx claude-flow@2.0.0 neural profile --real-time
```
**Solutions:**
```bash
# Solution 1: Enable SIMD optimization
npx claude-flow@2.0.0 wasm optimize --enable-simd
# Solution 2: Adjust training parameters
npx claude-flow@2.0.0 neural train \
--pattern-type coordination \
--epochs 50 \
--batch-size 16 \
--learning-rate 0.001
# Solution 3: Increase memory allocation
export UV_THREADPOOL_SIZE=16
node --max-old-space-size=4096
# Solution 4: Use distributed training
npx claude-flow@2.0.0 neural train \
--distributed \
--workers 4
```
### Issue 3: Model Inference Errors
**Symptoms:**
- Inference returns NaN or invalid results
- High inference latency
- Model predictions are inconsistent
**Diagnosis:**
```bash
# Validate model integrity
npx claude-flow@2.0.0 neural validate --model-id coordination-v1
# Check input data format
npx claude-flow@2.0.0 neural predict \
--model-id coordination-v1 \
--input "test data" \
--debug
```
**Solutions:**
```bash
# Solution 1: Retrain model with better data
npx claude-flow@2.0.0 neural train \
--pattern-type coordination \
--training-data "./data/validated-patterns.json" \
--epochs 100
# Solution 2: Compress and optimize model
npx claude-flow@2.0.0 neural compress \
--model-id coordination-v1 \
--ratio 0.7
# Solution 3: Use ensemble prediction
npx claude-flow@2.0.0 ensemble create \
--models "coord-v1,coord-v2,coord-v3" \
--strategy voting
# Solution 4: Clear model cache
rm -rf ./models/cache/
npx claude-flow@2.0.0 model reload --all
```
---
## 💾 Memory & Persistence Issues
### Issue 1: Memory Data Corruption
**Symptoms:**
- Memory queries return corrupted data
- Random data loss across sessions
- Error: "Memory consistency check failed"
**Diagnosis:**
```bash
# Check memory integrity
npx claude-flow@2.0.0 memory usage --action validate --all-namespaces
# Analyze corruption patterns
npx claude-flow@2.0.0 memory analytics --corruption-analysis
# Check file system status
df -h .
fsck -n ./memory/claude-flow-data.json
```
**Solutions:**
```bash
# Solution 1: Restore from backup
npx claude-flow@2.0.0 memory backup --list
npx claude-flow@2.0.0 memory restore --backup-path ./backups/latest
# Solution 2: Rebuild memory database
npx claude-flow@2.0.0 memory usage --action rebuild --force
npx claude-flow@2.0.0 memory compress --optimize
# Solution 3: Check and fix permissions
chmod 755 ./memory/
chown -R $USER:$USER ./memory/
# Solution 4: Emergency data recovery
npx claude-flow@2.0.0 memory backup --emergency --format json
```
### Issue 2: High Memory Usage
**Symptoms:**
- Memory usage continuously growing
- Out of memory errors
- Slow memory operations
**Diagnosis:**
```bash
# Monitor memory usage
npx claude-flow@2.0.0 memory analytics --real-time
npx claude-flow@2.0.0 memory usage --action stats
# Check for memory leaks
node --trace-gc
node --heap-prof
```
**Solutions:**
```bash
# Solution 1: Compress existing data
npx claude-flow@2.0.0 memory compress --all-namespaces --ratio 0.8
# Solution 2: Clean old entries
npx claude-flow@2.0.0 memory usage \
--action delete \
--older-than "7d" \
--exclude-important
# Solution 3: Optimize storage
npx claude-flow@2.0.0 memory usage --action optimize-storage
# Solution 4: Increase memory limits
export NODE_OPTIONS="--max-old-space-size=8192"
```
### Issue 3: Cross-Session Persistence Failures
**Symptoms:**
- Data not persisting between sessions
- Fresh installations lose configuration
- Settings reset randomly
**Diagnosis:**
```bash
# Check persistence mechanisms
npx claude-flow@2.0.0 memory persist --test
ls -la ./memory/sessions/
# Verify database connectivity
sqlite3 ./memory/claude-flow-data.json ".schema"
```
**Solutions:**
```bash
# Solution 1: Repair persistence layer
npx claude-flow@2.0.0 memory persist --repair
# Solution 2: Reinitialize session storage
rm -rf ./memory/sessions/
npx claude-flow@2.0.0 init --claude --force
# Solution 3: Check disk space and permissions
df -h .
chmod 755 ./memory/sessions/
# Solution 4: Use alternative backend
npx claude-flow@2.0.0 config update \
--section memory \
--config '{"backend": "postgresql"}'
```
---
## 🔧 MCP Integration Issues
### Issue 1: MCP Server Connection Failures
**Symptoms:**
- Error: "MCP server not responding"
- Tools showing as unavailable
- Timeout errors on MCP calls
**Diagnosis:**
```bash
# Check MCP server status
claude mcp status ruv-swarm
claude mcp logs ruv-swarm --tail 50
# Test connectivity
claude mcp test ruv-swarm
netstat -tulpn | grep :8080
```
**Solutions:**
```bash
# Solution 1: Restart MCP server
claude mcp stop ruv-swarm
claude mcp start ruv-swarm
# Solution 2: Clear MCP cache
rm -rf ~/.claude/mcp-cache/
claude mcp restart ruv-swarm
# Solution 3: Check port conflicts
lsof -i :8080
# Kill conflicting processes if needed
# Solution 4: Reinstall MCP integration
claude mcp remove ruv-swarm
claude mcp add ruv-swarm npx ruv-swarm mcp start
```
### Issue 2: Tool Registration Problems
**Symptoms:**
- Some tools missing from available list
- Tool calls fail with "unknown tool" error
- Inconsistent tool availability
**Diagnosis:**
```bash
# List available tools
claude mcp list-tools ruv-swarm | wc -l # Should be 87
# Check specific tool
claude mcp describe-tool ruv-swarm mcp__claude-flow__swarm_init
# Verify tool registration
claude mcp validate ruv-swarm
```
**Solutions:**
```bash
# Solution 1: Force tool refresh
claude mcp refresh ruv-swarm
# Solution 2: Re-register tools
npx ruv-swarm mcp register-tools --force
# Solution 3: Check tool permissions
npx ruv-swarm mcp validate --tools-only
# Solution 4: Update to latest version
npm update -g ruv-swarm
claude mcp update ruv-swarm
```
### Issue 3: Batch Operations Failures
**Symptoms:**
- Batch tool calls timeout
- Partial execution of batch operations
- Inconsistent results across batch items
**Diagnosis:**
```bash
# Test batch operation
claude mcp batch-test ruv-swarm --operations 5
# Check batch limits
claude mcp config ruv-swarm | grep batch
# Monitor batch performance
npx claude-flow@2.0.0 performance report --mcp-focus
```
**Solutions:**
```bash
# Solution 1: Adjust batch size
export CLAUDE_BATCH_SIZE=8
export CLAUDE_BATCH_TIMEOUT=60000
# Solution 2: Enable parallel batch processing
claude mcp config ruv-swarm --set parallel_batches=true
# Solution 3: Implement retry logic
export CLAUDE_BATCH_RETRIES=3
# Solution 4: Use sequential fallback
export CLAUDE_BATCH_FALLBACK=sequential
```
---
## 🌐 Web UI Issues
### Issue 1: WebUI Not Loading
**Symptoms:**
- Browser shows "Cannot connect" error
- WebUI stuck on loading screen
- 500 internal server error
**Diagnosis:**
```bash
# Check WebUI server status
npx claude-flow@2.0.0 start --ui --test-mode
curl -f http://localhost:3000/health
# Check logs
npx claude-flow@2.0.0 logs --component webui --tail 50
# Verify port availability
netstat -tulpn | grep :3000
```
**Solutions:**
```bash
# Solution 1: Restart WebUI server
npx claude-flow@2.0.0 stop
npx claude-flow@2.0.0 start --ui --port 3000
# Solution 2: Clear browser cache
# In browser: Clear cache and hard reload (Ctrl+Shift+R)
# Solution 3: Use different port
npx claude-flow@2.0.0 start --ui --port 3001
# Solution 4: Check firewall settings
sudo ufw allow 3000
# Or on Windows: New-NetFirewallRule -DisplayName "Claude Flow" -Direction Inbound -Port 3000 -Protocol TCP -Action Allow
```
### Issue 2: Real-time Updates Not Working
**Symptoms:**
- Status indicators not updating
- Agent activities not showing
- WebSocket connection errors
**Diagnosis:**
```bash
# Check WebSocket connectivity
npx claude-flow@2.0.0 websocket test
# Monitor WebSocket traffic
npx claude-flow@2.0.0 logs --component websocket --real-time
# Test browser WebSocket support
# In browser console: typeof WebSocket
```
**Solutions:**
```bash
# Solution 1: Enable WebSocket explicitly
npx claude-flow@2.0.0 start --ui --websockets --port 3000
# Solution 2: Check proxy settings
# Disable proxy for localhost in browser settings
# Solution 3: Use polling fallback
npx claude-flow@2.0.0 config update \
--section webui \
--config '{"realtime": "polling", "polling_interval": 2000}'
# Solution 4: Check network configuration
ping localhost
telnet localhost 3000
```
### Issue 3: Performance Dashboard Issues
**Symptoms:**
- Metrics not displaying correctly
- Charts showing outdated data
- Performance graphs empty
**Diagnosis:**
```bash
# Check metrics collection
npx claude-flow@2.0.0 metrics collect --test
# Verify data pipeline
npx claude-flow@2.0.0 performance report --format json
# Test chart rendering
npx claude-flow@2.0.0 webui validate --charts
```
**Solutions:**
```bash
# Solution 1: Reset metrics database
npx claude-flow@2.0.0 metrics reset --confirm
# Solution 2: Force metrics refresh
npx claude-flow@2.0.0 metrics collect --force --all-components
# Solution 3: Check browser compatibility
# Ensure browser supports modern JavaScript and Canvas
# Solution 4: Use simplified dashboard
npx claude-flow@2.0.0 start --ui --simple-mode
```
---
## 🏢 Enterprise Deployment Issues
### Issue 1: Container Deployment Failures
**Symptoms:**
- Docker containers failing to start
- Kubernetes pods in CrashLoopBackOff
- Resource allocation errors
**Diagnosis:**
```bash
# Check container status
docker ps -a | grep claude-flow
kubectl get pods -n claude-flow
# View container logs
docker logs claude-flow-container
kubectl logs -f deployment/claude-flow-v2 -n claude-flow
# Check resource usage
docker stats claude-flow-container
kubectl top pods -n claude-flow
```
**Solutions:**
```bash
# Solution 1: Increase resource limits
# In docker-compose.yml:
# deploy:
# resources:
# limits:
# memory: 4G
# cpus: '2.0'
# Solution 2: Fix environment variables
docker run -e NODE_ENV=production -e CLAUDE_FLOW_VERSION=2.0.0 claude-flow:2.0.0
# Solution 3: Check volume mounts
docker run -v ./data:/app/data -v ./memory:/app/memory claude-flow:2.0.0
# Solution 4: Use health checks
# Add to Dockerfile:
# HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
# CMD npx claude-flow health-check || exit 1
```
### Issue 2: Load Balancing Problems
**Symptoms:**
- Uneven request distribution
- Some instances overloaded
- Session affinity issues
**Diagnosis:**
```bash
# Check load balancer status
kubectl get services -n claude-flow
kubectl describe service claude-flow-service
# Monitor request distribution
kubectl logs -f deployment/nginx-lb -n claude-flow
# Test load balancing
for i in {1..10}; do curl -s http://your-domain.com/health; done
```
**Solutions:**
```bash
# Solution 1: Configure session affinity
# In kubernetes service:
# sessionAffinity: ClientIP
# sessionAffinityConfig:
# clientIP:
# timeoutSeconds: 10800
# Solution 2: Adjust load balancing algorithm
# In nginx.conf:
# upstream claude_flow {
# least_conn;
# server claude-flow-1:3000;
# server claude-flow-2:3000;
# }
# Solution 3: Implement health checks
# In nginx.conf:
# server claude-flow-1:3000 max_fails=3 fail_timeout=30s;
# Solution 4: Use sticky sessions for coordination
# Add to nginx:
# ip_hash;
```
### Issue 3: Database Connection Issues
**Symptoms:**
- Connection pool exhaustion
- Database timeouts
- Data consistency errors
**Diagnosis:**
```bash
# Check database connectivity
psql -h postgres-host -U claude_flow -d claude_flow -c "SELECT 1;"
# Monitor connection pool
npx claude-flow@2.0.0 database status --connections
# Check for locks
psql -c "SELECT * FROM pg_locks WHERE NOT granted;"
```
**Solutions:**
```bash
# Solution 1: Increase connection pool size
# In config/production.json:
# "database": {
# "pool": {
# "min": 5,
# "max": 50,
# "acquireTimeoutMillis": 60000,
# "idleTimeoutMillis": 600000
# }
# }
# Solution 2: Enable connection retry
# "database": {
# "retry": {
# "max": 3,
# "delay": 5000
# }
# }
# Solution 3: Use read replicas
# "database": {
# "read_replicas": [
# "postgres-read-1:5432",
# "postgres-read-2:5432"
# ]
# }
# Solution 4: Implement connection health checks
npx claude-flow@2.0.0 database migrate --check-health
```
---
## 🔍 Performance Optimization
### Memory Optimization
```bash
# Optimize memory usage across all components
npx claude-flow@2.0.0 memory compress --all-components --ratio 0.8
# Clean up old data
npx claude-flow@2.0.0 memory usage \
--action cleanup \
--older-than "7d" \
--backup-first
# Tune garbage collection
export NODE_OPTIONS="--max-old-space-size=4096 --optimize-for-size"
```
### Network Optimization
```bash
# Enable compression
npx claude-flow@2.0.0 config update \
--section network \
--config '{"compression": true, "compression_level": 6}'
# Tune connection pooling
npx claude-flow@2.0.0 config update \
--section mcp \
--config '{"pool_size": 20, "keep_alive": true}'
# Enable caching
npx claude-flow@2.0.0 cache manage --action enable-all
```
### CPU Optimization
```bash
# Enable multi-threading
export UV_THREADPOOL_SIZE=16
# Use worker threads for heavy operations
npx claude-flow@2.0.0 config update \
--section workers \
--config '{"neural_workers": 4, "coordination_workers": 8}'
# Enable SIMD optimization
npx claude-flow@2.0.0 wasm optimize --enable-simd
```
---
## 📞 Getting Help
### Support Channels
1. **Documentation**: Check `/workspaces/claude-code-flow/docs/`
2. **GitHub Issues**: https://github.com/ruvnet/claude-code-flow/issues
3. **Community**: https://github.com/ruvnet/claude-code-flow/discussions
4. **Performance Reports**: Use built-in diagnostic tools
### Reporting Issues
When reporting issues, include:
```bash
# Generate diagnostic report
npx claude-flow@2.0.0 diagnostic export --format comprehensive
# Include system information
npx claude-flow@2.0.0 env-info
# Attach relevant logs
npx claude-flow@2.0.0 logs --all-components --last 1h
```
### Emergency Recovery
```bash
# Complete system reset (use with caution)
npx claude-flow@2.0.0 emergency-reset --backup-first
# Factory reset while preserving data
npx claude-flow@2.0.0 reset --keep-data --keep-models
# Restore from backup
npx claude-flow@2.0.0 restore --backup-path ./emergency-backup/
```
This comprehensive troubleshooting guide should help resolve most issues encountered with Claude Flow v2.0.0. For persistent problems, refer to the diagnostic tools and support channels mentioned above.