Troubleshooting Guide¶
Common issues and solutions for the Fleet Decision Platform.
Quick Diagnostics¶
# Check service health
curl http://localhost:8000/health
# Check logs for errors
grep "ERROR" logs/fleet_cascade.log | tail -20
# Check system resources
top -p $(pgrep -f uvicorn)
# Check port availability
lsof -i :8000
Common Issues¶
Installation Issues¶
uv command not found
Cause: uv is not installed or not in PATH.
Solution:
Python version mismatch
Cause: Wrong Python version installed.
Solution:
Dependency resolution failed
Cause: Conflicting package versions.
Solution:
Startup Issues¶
Port 8000 already in use
Cause: Another process is using the port.
Solution:
Configuration file not found
Cause: Missing or misplaced config file.
Solution:
Environment variables not loaded
Cause: Missing .env file or incorrect format.
Solution:
API Issues¶
500 Internal Server Error
Cause: Unhandled exception in application.
Solution:
422 Validation Error
Cause: Invalid request body.
Solution:
Timeout on optimization requests
Cause: Optimization taking too long.
Solution:
Optimization Issues¶
Infeasible optimization problem
Cause: Constraints cannot be satisfied.
Solution:
# Check constraint feasibility
total_supply = sum(vehicles)
total_demand = sum(demand_forecast)
if total_supply < total_demand * min_service_level:
print("Not enough vehicles to meet service level")
# Relax constraints
constraints = {
"min_service_level": 0.8, # Lower from 0.95
"max_distance": 150 # Increase from 100
}
Suboptimal solutions
Cause: Solver time limit or gap tolerance too strict.
Solution:
Optimization is very slow
Cause: Large problem size or inefficient formulation.
Solution:
Data Issues¶
Kaggle download fails
Cause: Invalid or expired API credentials.
Solution:
Model file not found
Cause: Model not trained or wrong path.
Solution:
Data type errors
Cause: Unexpected data format.
Solution:
Database Issues¶
Cannot connect to PostgreSQL
Cause: Database not running or wrong credentials.
Solution:
Redis connection refused
Cause: Redis not running.
Solution:
Debugging Techniques¶
Enable Debug Logging¶
Interactive Debugging¶
# Add breakpoint
import pdb; pdb.set_trace()
# Or use ipdb (install first)
import ipdb; ipdb.set_trace()
Profile Performance¶
import cProfile
import pstats
profiler = cProfile.Profile()
profiler.enable()
# Your code here
result = optimizer.optimize(...)
profiler.disable()
stats = pstats.Stats(profiler)
stats.sort_stats('cumtime')
stats.print_stats(20)
Getting Help¶
- Check Logs:
tail -f logs/fleet_cascade.log - Search Issues: GitHub Issues
- Ask Community: GitHub Discussions
- Documentation: Review relevant guides
Next Steps¶
- Monitoring - Set up observability
- Deployment - Production deployment