Issue: Agent returned generic "Error: 404" without context Fix:
- Added detailed error messages for connection problems
- Implemented
_check_connection()method to verify Ollama is accessible - Proper HTTP status code handling (404, 500, timeouts)
Issue: User couldn't understand why agent failed Fix:
- Specific error messages for each failure type
- Built-in troubleshooting tips
- Suggests exact commands to fix issues
Issue: "Model not found" without help on what to do Fix:
- Shows which models are available
- Suggests
ollama pullcommands - Links to API endpoint for verification
Issue: Agent would hang or fail silently Fix:
- Better timeout handling (distinguishes between slow response and timeout)
- Connection errors are caught and reported
- Fallback messages for all error scenarios
-
Added
_check_connection()method- Verifies Ollama is running before tasks
- Provides immediate feedback on startup
-
Improved
_check_models()method- Better error handling for connection failures
- Distinguishes between connection error and 404
-
Enhanced
call_llm()method- Handles specific HTTP status codes (404, 500)
- Connection error handling
- Timeout detection with clear messages
-
Better
_call_agent()method- Same improvements for multi-agent mode
-
Improved main loop in
process_task()- Detects error responses
- Shows troubleshooting tips
- Gracefully exits on connection errors
- What is DeepCode and how it works
- Setup instructions
- Usage examples
- Smart model selection explanation
- System requirements
- Common issues and solutions
- Step-by-step fixes
- Connection testing
- Advanced debugging
- Quick fix checklist
- Windows batch script for easy setup
- Checks for Python and Ollama
- Installs packages
- Pulls required models
- Python package dependencies
- Easy installation:
pip install -r requirements.txt
Error: 404
✨ Task Complete!
❌ User confused - what went wrong? How to fix?
Error: Model 'qwen2.5-coder:latest' not found on Ollama.
Available at http://localhost:11434/api/tags
💡 Troubleshooting tips:
1. Make sure Ollama is running: 'ollama serve'
2. Check if model is installed: 'ollama list'
3. Pull the model: 'ollama pull qwen2.5-coder'
✅ User knows exactly what to do
# Terminal 1: Start Ollama
ollama serve
# Terminal 2: Run DeepCode
python deepcode.pyThe script now automatically detects and suggests:
- Check Ollama is running
- Install missing models
- Verify connection
- ✓ Real-time connection checking
- ✓ Helpful error messages
- ✓ Auto-troubleshooting suggestions
- ✓ Clear model availability info
- ✓ Timeout detection
The code has been tested with:
- ✓ Ollama running (connection success)
- ✓ Ollama offline (connection failure detected)
- ✓ Models missing (helpful suggestions)
- ✓ Invalid model names (clear error)
- Start Ollama:
ollama serve - Install models:
ollama pull qwen2.5-coder ollama pull deepseek-coder-v2:16b - Run DeepCode:
python deepcode.py - Try a task:
build a rest api
| Issue | Status | Solution |
|---|---|---|
| Generic 404 errors | ✓ Fixed | Specific error messages |
| No troubleshooting help | ✓ Fixed | Built-in tips and guidance |
| Silent failures | ✓ Fixed | Clear error detection |
| Unclear model issues | ✓ Fixed | Shows available models |
| Timeout confusion | ✓ Fixed | Distinguishes timeout from slow response |
| No documentation | ✓ Fixed | README + TROUBLESHOOTING guides |
DeepCode/
├── deepcode.py (✓ Enhanced error handling)
├── README.md (✓ New - Setup guide)
├── TROUBLESHOOTING.md (✓ New - Fix guide)
├── requirements.txt (✓ New - Dependencies)
├── setup.bat (✓ New - Windows setup)
└── FIXES.md (✓ This file)
Your code is now production-ready with proper error handling!