Troubleshooting Guide
This troubleshooting guide covers theoretical issues for an untested experimental feature. Many real-world problems may not be documented here, and suggested solutions may not work.
Key Warnings:
- Issues described may not match actual problems encountered
- Solutions provided are untested and may not resolve issues
- New error types not covered in this guide are likely
- Debug techniques may require modifications to work
- Community support is limited for troubleshooting
Expect to encounter undocumented issues when using this experimental software.
Common issues and solutions when using the Brobot MCP Server.
Server Issuesโ
Server Won't Startโ
Symptomโ
$ python -m mcp_server.main
ModuleNotFoundError: No module named 'mcp_server'
Solutionsโ
-
Check Python version
python --version # Should be 3.8 or higher -
Install in development mode
pip install -e . -
Verify installation
pip list | grep brobot -
Check virtual environment
# Ensure you're in the correct venv
which python
# Should show your venv path
Port Already in Useโ
Symptomโ
ERROR: [Errno 48] Address already in use
Solutionsโ
-
Find process using port
# Linux/Mac
lsof -i :8000
# Windows
netstat -ano | findstr :8000 -
Kill the process
# Linux/Mac
kill -9 <PID>
# Windows
taskkill /PID <PID> /F -
Use different port
MCP_PORT=8080 python -m mcp_server.main
Import Errorsโ
Symptomโ
ImportError: cannot import name 'BaseSettings' from 'pydantic'
Solutionโ
Install correct Pydantic version:
pip install pydantic-settings
CLI Integration Issuesโ
CLI JAR Not Foundโ
Symptomโ
FileNotFoundError: Brobot CLI JAR not found at: brobot-cli.jar
Solutionsโ
-
Build the CLI
cd brobot-cli
gradle shadowJar
# or
./gradlew shadowJar -
Check JAR location
ls brobot-cli/build/libs/ -
Update configuration
BROBOT_CLI_JAR=/absolute/path/to/brobot-cli.jar
Java Not Foundโ
Symptomโ
subprocess.CalledProcessError: Command '['java', '-jar', ...]' returned non-zero exit status 127
Solutionsโ
-
Install Java
# Ubuntu/Debian
sudo apt install openjdk-11-jdk
# macOS
brew install openjdk@11
# Windows
winget install Microsoft.OpenJDK.11 -
Check Java installation
java -version
javac -version -
Set JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home) # macOS
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk # Linux
CLI Timeout Errorsโ
Symptomโ
BrobotCLIError: Command timed out after 30 seconds
Solutionsโ
-
Increase timeout
CLI_TIMEOUT=60.0 -
Check system performance
# Monitor CPU/memory during execution
top # or htop -
Reduce CLI load
# Check if other Java processes are consuming resources
ps aux | grep java
# Use mock mode to isolate if issue is CLI or server
USE_MOCK_DATA=true python -m mcp_server.main
API Issuesโ
500 Internal Server Errorโ
Symptomโ
{
"detail": "Internal server error"
}
Solutionsโ
-
Check server logs
# Enable debug logging
MCP_LOG_LEVEL=debug python -m mcp_server.main -
Test in mock mode
USE_MOCK_DATA=true -
Validate CLI directly
java -jar brobot-cli.jar get-state-structure
Pattern Not Foundโ
Symptomโ
{
"success": false,
"error": "Pattern not found: button.png"
}
Solutionsโ
-
Verify pattern exists
ls patterns/ # Check your pattern directory -
Lower confidence threshold
from brobot_client import BrobotClient
client = BrobotClient()
client.click("button.png", confidence=0.7) -
Save screenshot for debugging
from brobot_client import BrobotClient
client = BrobotClient()
obs = client.get_observation()
if obs.save_screenshot("debug.png"):
print("Screenshot saved successfully")
# Review debug.png to see what patterns are visible
State Not Detectedโ
Symptomโ
{
"active_states": [],
"screenshot": "..."
}
Solutionsโ
-
Check state configuration
- Verify state images exist
- Ensure patterns are up-to-date
- Check that images directory is accessible to the CLI
-
Test in mock mode first
# Verify API works correctly
USE_MOCK_DATA=trueIf mock mode shows states but real mode doesn't, the issue is with Brobot CLI configuration.
-
Debug state detection
from brobot_client import BrobotClient
client = BrobotClient()
# Get detailed state info
structure = client.get_state_structure()
for state in structure.states:
print(f"{state.name}: {state.images}")
Client Issuesโ
Connection Refusedโ
Symptomโ
BrobotConnectionError: Failed to connect to server at http://localhost:8000
Solutionsโ
-
Verify server is running
curl http://localhost:8000/health -
Check firewall
# Linux
sudo ufw status
# Windows
netsh advfirewall show allprofiles -
Use correct URL
from brobot_client import BrobotClient
client = BrobotClient("http://127.0.0.1:8000") # Try IP instead
Timeout Errorsโ
Symptomโ
BrobotTimeoutError: Request timed out after 30s
Solutionsโ
-
Increase client timeout
from brobot_client import BrobotClient
client = BrobotClient(timeout=60.0) -
Check network latency
ping localhost -
Use longer timeouts for slow operations
# Set longer timeout for specific operations
result = client.click("slow_button.png", timeout=90.0)
Performance Issuesโ
Slow Pattern Matchingโ
Solutionsโ
-
Optimize image patterns
- Use smaller images
- Remove unnecessary details
- Use distinctive features
-
Use lower confidence thresholds
# Lower threshold for faster (but less accurate) matching
client.click("button.png", confidence=0.7) -
Optimize timeout settings
# Reduce CLI timeout if operations are simple
CLI_TIMEOUT=15.0
High Memory Usageโ
Advanced memory management and performance tuning options are not yet implemented in the MCP server. These features may be added in future releases.
Current Solutionsโ
-
Use mock mode for testing
USE_MOCK_DATA=true # Reduces memory usage -
Restart server periodically
# Restart server to free memory
# Stop current server (Ctrl+C)
python -m mcp_server.main -
Monitor memory usage
# Check memory usage
ps aux | grep -E "(java|python)" | grep -v grep
Docker Issuesโ
Container Can't Access Displayโ
Symptomโ
Error: Cannot open display
Solutionsโ
-
Linux: Share X11 socket
docker run -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
brobot-mcp-server -
macOS: Use XQuartz
# Install XQuartz
brew install --cask xquartz
# Allow connections
xhost +localhost -
Windows: Use X server
- Install VcXsrv or similar
- Configure display forwarding
Common Error Messagesโ
"No module named 'cv2'"โ
Solution: Install OpenCV
pip install opencv-python
"Failed to validate Brobot CLI"โ
Solution: Test CLI manually
java -jar brobot-cli.jar --version
"Invalid JSON response from CLI"โ
Solution: Check CLI output format
java -jar brobot-cli.jar get-state-structure | jq .
Debug Techniquesโ
Enable Verbose Loggingโ
import logging
logging.basicConfig(level=logging.DEBUG)
# Now client will show detailed logs
client = BrobotClient()
Save Debug Informationโ
import json
from datetime import datetime
from brobot_client import BrobotClient
client = BrobotClient()
def debug_automation():
try:
result = client.click("button.png")
except Exception as e:
# Save debug info
obs = client.get_observation()
obs.save_screenshot("error_screenshot.png")
with open("debug_log.json", "w") as f:
json.dump({
"error": str(e),
"active_states": [s.name for s in obs.active_states],
"timestamp": datetime.now().isoformat()
}, f, indent=2)
raise
Monitor System Resourcesโ
# Watch resource usage during automation
watch -n 1 'ps aux | grep -E "(java|python)" | grep -v grep'
Related Documentationโ
Before seeking help, review these related guides:
- ๐ฆ Installation Guide - Platform-specific setup and system requirements
- โ๏ธ Configuration Guide - All configuration options explained
- ๐ Getting Started - Basic usage patterns and examples
- ๐ API Reference - Complete endpoint documentation
- ๐ก Examples - Integration patterns with AI services
For core Brobot framework issues (not MCP server specific):
- Brobot Installation - Core framework setup
- Brobot States - Understanding state-based automation
- Brobot Core Concepts - Framework architecture
Getting Helpโ
Support for this experimental feature is limited to community contributions. Response times may be slow, and many issues may remain unresolved.
If these solutions don't resolve your issue:
- Review related documentation - Check the guides listed above
- Search existing issues: GitHub Issues
- Create detailed bug report with:
- Error messages
- System information (OS, Python/Java versions)
- Configuration files (.env contents)
- Steps to reproduce
- Relevant log output
- Include environment details:
python --version
java -version
pip list | grep brobot
FAQโ
Q: Can I run MCP server on a headless system? A: Yes, use a virtual display like Xvfb:
xvfb-run -a python -m mcp_server.main
Q: How do I update image patterns? A: Place new images in your patterns directory and restart the server.
Q: Can multiple clients connect simultaneously? A: Yes, the server handles multiple connections, but actions are serialized.
Q: Is Windows support available? A: Yes, but some features may require additional configuration.
Q: How do I contribute fixes? A: Fork the repository, make changes, and submit a pull request!