You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AI-powered error analysis and explanation tool for multiple programming languages.
Explain error logs from Python, JavaScript, TypeScript, C++, and Java using Google's Gemini AI directly from your terminal. Get instant, intelligent explanations and fix suggestions for any programming error.
# Auto-detect language from error
xerror detect "NameError: name 'x' is not defined"
xerror detect "TypeError: Cannot read property 'length' of undefined"
xerror detect "TS2322: Type 'string' is not assignable to type 'number'"
xerror detect "error: 'cout' was not declared in this scope"
xerror detect "Exception in thread \"main\" java.lang.NullPointerException"
3. Real-time Process Monitoring
# Watch a running process for errors
xerror watch "python my_script.py"# Watch with custom command
xerror watch "npm start"# Watch in background mode
xerror watch "python long_running_script.py" --background
4. Python API Examples
importxerror# Basic error explanationresult=xerror.explain_error("NameError: name 'x' is not defined")
print(result['explanation'])
# Language detectionlanguage=xerror.detect_language("TypeError: Cannot read property 'length' of undefined")
print(f"Detected language: {language}")
# Parse error detailserror_info=xerror.parse_error("TS2322: Type 'string' is not assignable to type 'number'")
print(f"Error type: {error_info.error_type}")
print(f"Language: {error_info.language}")
# Quick explanation (rule-based only)explanation=xerror.quick_explain("TypeError: can only concatenate str (not 'int') to str")
print(explanation)
# Automatic error handlingwithxerror.auto_explain_exceptions():
undefined_variable# This will be automatically explained# Function decorator@xerror.explain_function_errors()defmy_function():
returnundefined_variable
// TS2322: Type assignment error
TS2322: Type'string'isnotassignabletotype'number'// TS2339: Property does not exist
TS2339: Property'length'doesnotexistontype'number'// TS2307: Module not found
TS2307: Cannotfind module './Component'// TS2345: Argument type mismatch
TS2345: Argumentoftype'string'isnotassignabletoparameteroftype'number'// TS2531: Object is possibly null
TS2531: Objectispossibly'null'
C++ Errors
// Compilation error
error: 'cout' was not declared in this scope
// Syntax error
error: expected ';' before '}' token
// Missing include
error: 'vector' was not declared in this scope
// Linker error
undefined reference to 'main'// Runtime error
Segmentation fault (core dumped)
Java Errors
// NullPointerExceptionExceptioninthread"main"java.lang.NullPointerException// Compilation errorerror: cannotfindsymbol: variablex// Class not foundjava.lang.ClassNotFoundException: com.example.MyClass// ArrayIndexOutOfBoundsExceptionjava.lang.ArrayIndexOutOfBoundsException: Index5outofboundsforlength3// NumberFormatExceptionjava.lang.NumberFormatException: Forinputstring: "abc"
🐍 Python API Reference
Core Functions
Function
Description
Returns
Example
explain_error(error_text)
Full AI-powered error explanation
Dict with explanation, confidence, method
explain_error("NameError: name 'x' is not defined")
quick_explain(error_text)
Fast rule-based explanation
String explanation
quick_explain("TypeError: can only concatenate str (not 'int') to str")
detect_language(error_text)
Detect programming language
Language enum
detect_language("TypeError: Cannot read property 'length' of undefined")
parse_error(error_text)
Parse error details
ErrorInfo object
parse_error("TS2322: Type 'string' is not assignable to type 'number'")
get_supported_languages()
Get list of supported languages
List of Language enums
get_supported_languages()
Context Managers
Context Manager
Description
Example
auto_explain_exceptions()
Automatically explain any exceptions
with auto_explain_exceptions(): ...
watch_process(command)
Monitor a running process for errors
with watch_process("python script.py"): ...
Decorators
Decorator
Description
Example
explain_function_errors()
Automatically explain errors in decorated function
# Run all tests
python -m pytest
# Run specific test categories
python -m pytest test_multi_language.py
python -m pytest test_api_proper.py
python -m pytest test_watcher.py
python -m pytest test_multi_model.py
# Run with coverage
python -m pytest --cov=xerror
# Run with verbose output
python -m pytest -v
# Run tests in parallel
python -m pytest -n auto
Test Coverage
Component
Test Files
Coverage
Status
Core Language Detection
test_multi_language.py
✅ 100%
🟢 Complete
Python API
test_api_proper.py
✅ 100%
🟢 Complete
Real-time Monitoring
test_watcher.py
✅ 100%
🟢 Complete
Multi-Model Support
test_multi_model.py
✅ 100%
🟢 Complete
Error Parsing
test_parser.py
✅ 100%
🟢 Complete
Rule-Based Explainer
test_rule_based.py
✅ 100%
🟢 Complete
Test Examples
# Test language detection
python test_multi_language.py
# Test API functionality
python test_api_proper.py
# Test watcher functionality
python test_watcher.py
# Test multi-model support
python test_multi_model.py
🔧 Advanced Usage
AI Mode vs Offline Mode
Feature
AI Mode
Offline Mode
API Key Required
✅ Yes
❌ No
Internet Connection
✅ Yes
❌ No
Response Time
2-5 seconds
Instant
Explanation Quality
High (contextual)
Good (rule-based)
Coverage
All errors
Common errors
Cost
API usage
Free
Best For
Complex/unique errors
Common errors, offline use
# AI mode (requires API key)
xerror error.log
# Offline mode (no API key needed)
xerror error.log --offline
Multi-Model Support
Model
Provider
Status
Features
Cost
Gemini 1.5 Flash
Google
✅ Active
Fast, cost-effective
Low
Gemini 1.5 Pro
Google
⚠️ Limited
Higher quality, slower
Medium
OpenAI GPT-4
OpenAI
🔧 Optional
High quality, paid
High
Ollama Local
Local
🔧 Optional
Offline, customizable
Free
Custom Configuration
# Use custom API key for this session
xerror error.log --api-key your-custom-key
# Use different AI model
xerror error.log --model gemini-1.5-pro
# Set custom log directoryexport ERROR_EXPLAINER_LOG_DIR=/custom/path
xerror error.log --save
# Set default modelexport DEFAULT_MODEL=gemini-1.5-flash
Search with Filters
# Search by error type
xerror search "NameError"# Search by language
xerror search "python"# Search by keyword
xerror search "undefined"# Search by filename
xerror search "views.py"# Limit search results
xerror search "error" --limit 5
# Search with date range
xerror search "error" --since "2024-01-01" --until "2024-12-31"
🚨 Troubleshooting
Common Issues
Issue
Solution
Status
API Key Error
Set GOOGLE_API_KEY environment variable
✅ Fixed
Language Not Detected
Use --offline mode or check error format
✅ Fixed
Slow Response
Use offline mode or check internet connection
✅ Fixed
Import Error
Install with pip install xerror
✅ Fixed
Permission Denied
Check file permissions or use --offline
✅ Fixed
Error Messages
# If you see: "No API key found"export GOOGLE_API_KEY=your-api-key-here
# If you see: "Language not detected"
xerror error.log --offline
# If you see: "Import error"
pip install --upgrade xerror
# If you see: "Permission denied"
chmod +r error.log
Performance Tips
Use --offline mode for faster responses
Save explanations with --save to avoid re-analyzing
# Clone the repository
git clone https://github.com/xerror/xerror.git
cd xerror
# Install in development mode
pip install -e .# Install development dependencies
pip install -r requirements.txt
# Set up environment
cp env.example .env
# Edit .env with your API keys
Development Commands
# Run tests
python -m pytest
# Run linting
flake8 xerror/
# Format code
black xerror/
# Type checking
mypy xerror/
# Build package
python setup.py sdist bdist_wheel
# Install from local build
pip install dist/xerror-0.1.0.tar.gz
# Run security checks
bandit -r xerror/
Contributing Guidelines
Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Make your changes
Add tests for new functionality
Run tests: python -m pytest
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
AI-powered error analysis and explanation tool for multiple programming languages. Explain error logs from Python, JavaScript, TypeScript, C++, and Java using Google's Gemini AI directly from your terminal. Get instant, intelligent explanations and fix suggestions for any programming error.