Troubleshooting
Table of contents
Common Issues
Connection Problems
MongoDB Connection Failed
ERROR: Failed to connect to MongoDB
Solutions:
- Check MongoDB is running:
docker ps | grep mongodb
- Verify connection settings:
echo $MONGO_HOST echo $MONGO_PORT
- Test connection manually:
mongosh -u $MONGO_USER -p $MONGO_PASSWORD
Server Won’t Start
ERROR: address already in use
Solutions:
- Check for running instances:
ps aux | grep batch-gpt
- Kill existing process:
kill -9 <PID>
Processing Issues
Long Response Times
WARNING: Batch processing exceeding expected duration
Solutions:
- Check OpenAI batch status
- Verify network connectivity
- Review batch window setting:
echo $COLLATE_BATCHES_FOR_DURATION_IN_MS
Cache Problems
ERROR: Failed to cache response
Solutions:
- Check MongoDB space:
db.stats()
- Verify cache collection:
use batchgpt db.cached_responses.stats()
Diagnostic Tools
Log Analysis
# View recent logs
tail -f logs/batch-gpt.log
# Search for errors
grep ERROR logs/batch-gpt.log
MongoDB Diagnostics
# Check collections
use batchgpt
show collections
# View batch status
db.batch_logs.find().sort({timestamp: -1}).limit(1)
Monitor Tool
# Start monitor
./batch-monitor
# Filter for failed batches
# Use arrow keys to navigate to "Failed" tab
Performance Optimization
Batch Window Tuning
- Start with 5000ms
- Monitor batch sizes
- Adjust based on volume:
export COLLATE_BATCHES_FOR_DURATION_IN_MS=3000 # More frequent, smaller batches
Cache Management
- Regular maintenance
- Index optimization
- Storage monitoring
Getting Help
- Check documentation
- Review GitHub issues
- Open new issue with:
- Error messages
- Configuration
- Logs
- Steps to reproduce