Troubleshooting
Common Issues and Solutions
1. Command Not Found: ocmonitor
Problem: Terminal shows command not found: ocmonitor
Solutions:
# Check if Python scripts directory is in PATH
echo $PATH | grep -o '[^:]*python[^:]*bin'
# Find Python user base
python3 -m site --user-base
# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH="$(python3 -m site --user-base)/bin:$PATH"
# Reload shell
source ~/.bashrc # or ~/.zshrc
# Alternative: Use full path
python3 /path/to/ocmonitor/run_ocmonitor.py --help
# Alternative: Reinstall in development mode
cd /path/to/ocmonitor
python3 -m pip install -e .2. Import Errors and Dependencies
Problem: Python import errors when running commands
Solutions:
Option 1: Use pipx (Recommended for dependency issues)
# Uninstall current version
pipx uninstall ocmonitor
# Reinstall with pipx (creates clean isolated environment)
cd /path/to/ocmonitor
pipx install .Option 2: Fix pip installation
# Check Python version
python3 --version # Should be 3.8+
# Reinstall dependencies
python3 -m pip install -r requirements.txt --force-reinstall
# Check for missing dependencies
python3 -c "import click, rich, pydantic, toml; print('All dependencies OK')"
# Install specific missing package
python3 -m pip install click rich pydantic toml
# Clear Python cache
find . -name "__pycache__" -type d -exec rm -rf {} +
find . -name "*.pyc" -delete3. Architecture Compatibility Issues
Problem: Architecture mismatch errors (arm64 vs x86_64)
Solutions:
# Check system architecture
uname -m
# For Apple Silicon Macs, use native Python
which python3
/opt/homebrew/bin/python3 --version
# Reinstall with correct architecture
python3 -m pip uninstall pydantic pydantic-core
python3 -m pip install pydantic pydantic-core --no-cache-dir
# Force reinstall all dependencies
python3 -m pip install -r requirements.txt --force-reinstall --no-cache-dir4. Messages Directory Not Found
Problem: Messages directory not found error
Solutions:
# Check if OpenCode is installed
which opencode
# Check default location
ls -la ~/.local/share/opencode/storage/message
# Find OpenCode data directory
find ~ -name "opencode" -type d 2>/dev/null
# Check OpenCode configuration
opencode config list 2>/dev/null | grep storage
# Set custom path if different location
ocmonitor config set paths.messages_dir "/actual/path/to/messages"
# Verify path is accessible
ocmonitor config validate5. JSON Parsing Errors
Problem: Errors when reading session files
Solutions:
# Check for corrupted session files
find ~/.local/share/opencode/storage/message -name "*.json" -exec python3 -m json.tool {} \; > /dev/null
# Find specific problematic files
find ~/.local/share/opencode/storage/message -name "*.json" -print0 | while IFS= read -r -d '' file; do
python3 -m json.tool "$file" > /dev/null 2>&1 || echo "Invalid JSON: $file"
done
# Test with specific session
ocmonitor session ~/.local/share/opencode/storage/message/problematic_session
# Use verbose mode for debugging
ocmonitor sessions ~/.local/share/opencode/storage/message --verbose6. Permission Errors
Problem: Permission denied errors when accessing files
Solutions:
# Check file permissions
ls -la ~/.local/share/opencode/storage/message
# Fix permissions if needed
chmod -R 755 ~/.local/share/opencode/storage/message
# Check if export directory is writable
mkdir -p ./exports
touch ./exports/test.txt && rm ./exports/test.txt
# Use alternative export directory
ocmonitor config set export.export_dir "/tmp/ocmonitor-exports"7. Model Not Recognized
Problem: “Unknown model” in reports
Solutions:
# Check which models are configured
ocmonitor config show --section models
# View current models.json
cat models.json
# Find unrecognized model names in your data
grep -r "model.*:" ~/.local/share/opencode/storage/message | grep -v claude | grep -v grok | head -5
# Add missing model to models.json
# Edit models.json and add the new model configuration
# Validate models configuration
ocmonitor config validateSee Adding New Models for instructions on adding model configurations.
8. Export Failures
Problem: Export commands fail or produce empty files
Solutions:
# Test export with verbose output
ocmonitor export sessions ~/.local/share/opencode/storage/message --format csv --output test.csv --verbose
# Check export directory permissions
ls -la ./exports
# Try different export format
ocmonitor export sessions ~/.local/share/opencode/storage/message --format json --output test.json
# Test with limited data
ocmonitor export sessions ~/.local/share/opencode/storage/message --limit 5 --format csv
# Check disk space
df -h .Debug Mode
Enable Verbose Logging
# Run any command with verbose output
ocmonitor sessions ~/.local/share/opencode/storage/message --verbose
# Set debug environment variable
export OCMONITOR_DEBUG=1
ocmonitor sessions ~/.local/share/opencode/storage/messageCheck System Information
# Show system information for bug reports
ocmonitor config system-infoText Output Example:
System Information for Bug Reports
Environment:
OS: macOS 12.6
Architecture: arm64
Python Version: 3.9.16
OpenCode Monitor Version: 1.0.0
Python Environment:
Python Path: /opt/homebrew/bin/python3
Site Packages: /opt/homebrew/lib/python3.9/site-packages
User Base: /Users/username/Library/Python/3.9
Dependencies:
click: 8.1.7
rich: 13.7.0
pydantic: 2.5.2
toml: 0.10.2
Configuration:
Config File: ./config.toml (exists)
Models File: ./models.json (exists)
Messages Dir: ~/.local/share/opencode/storage/message (accessible)
Recent Errors: NoneGetting Help
Report Issues
When reporting issues, include:
-
System Information:
ocmonitor config system-info -
Error Messages: Full error output with
--verboseflag -
Configuration:
ocmonitor config show -
Steps to Reproduce: Exact commands that cause the issue
Community Support
- GitHub Issues: For bug reports and feature requests
- Discussions: For questions and community help
- Documentation: Check this guide and the other documentation pages