Visual Code Debugger — Paste an error, see an interactive call stack graph, get fix suggestions.
DebugLens parses Python tracebacks, JavaScript/TypeScript error stacks, and generic error formats. It classifies errors, detects common patterns, scores severity, and suggests fixes — all rendered as an interactive visual interface.
# Install dependencies
pip install -r requirements.txt
# Start the server
python server.py
# Open in browser
http://localhost:8503Paste any error traceback into the textarea and press Analyze (or Ctrl+Enter).
- Python tracebacks — full chain parsing (
__cause__,__context__) - JavaScript/TypeScript — Chrome and Node.js stack formats
- Generic errors — regex-based extraction for any language
- Local variable extraction from Python
Traceback - Chained exception support
- Classification — syntax, runtime, type, import, logic, resource, network, permission
- Pattern detection — 12+ built-in patterns (NoneType access, key errors, import cycles, etc.)
- Severity scoring — 1-10 scale with category-aware weighting
- Fix suggestions — actionable code examples with confidence scores
- Stack Overflow search — auto-generated search URLs
- Interactive D3.js call stack graph (click nodes to expand)
- Color-coded severity badge (low/medium/high/critical)
- Code context panel with highlighted error line
- Dark theme, responsive layout
Parse and analyze error text.
curl -X POST http://localhost:8503/analyze \
-H "Content-Type: application/json" \
-d '{"error_text": "Traceback...\nKeyError: \"missing\""}'Response:
{
"parsed": { "error_type": "KeyError", "frames": [...], ... },
"analysis": { "severity": 5, "category": "runtime", "fix_suggestions": [...] },
"stackoverflow_urls": [...]
}Analyze error with source file code context.
{
"error_text": "TypeError: ...",
"file_path": "/path/to/source.py",
"error_line": 42
}List all known error patterns and their metadata.
Get AI-powered fix suggestions (uses BHAASM Core if available, else rule-based).
{
"error_text": "...",
"context": "Optional additional context",
"file_path": "/optional/path"
}Service health check.
debuglens/
├── parser.py # Error traceback parser (Python, JS, generic)
├── analyzer.py # Pattern matching, classification, fix generation
├── server.py # FastAPI server (port 8503)
├── static/
│ └── index.html # Visual debugger UI (D3.js)
├── requirements.txt # Python dependencies
└── README.md
PythonTracebackParser— regex-based extraction of frames, chained exceptions, local variablesJavaScriptParser— Chrome/Node stack format parserGenericParser— fallback for unknown languagesErrorParser— auto-detects language and delegates
- 12 built-in error patterns with fixes (AttributeError, TypeError, KeyError, IndexError, ImportError, NameError, FileNotFoundError, ValueError, RecursionError, SyntaxError, ZeroDivisionError, PermissionError, ConnectionError)
ErrorAnalyzer.analyze()— pattern matching + severity scoringErrorAnalyzer.analyze_with_code()— adds file contextErrorAnalyzer.get_known_patterns()— pattern registry
- FastAPI with auto-generated Swagger docs at
/docs - Integration with BHAASM Core (optional, auto-detected)
- CORS enabled for development
| Error Type | Category | Severity |
|---|---|---|
AttributeError |
type | 6 |
TypeError |
type | 6 |
KeyError |
runtime | 5 |
IndexError |
runtime | 5 |
ImportError |
import | 7 |
NameError |
runtime | 5 |
FileNotFoundError |
resource | 6 |
ValueError |
type | 5 |
RecursionError |
logic | 8 |
SyntaxError |
syntax | 10 |
ZeroDivisionError |
logic | 6 |
PermissionError |
permission | 7 |
ConnectionError |
network | 7 |
- Python 3.9+
- FastAPI
- Uvicorn
- Pydantic
- Pygments (syntax highlighting)
MIT