Complete troubleshooting guide for Artistry.
# Windows - Check all services
cd artistry-backend
.\test_services.ps1
# Manual health check
curl http://localhost:8000/health # Gateway
curl http://localhost:8001/health # Detect
curl http://localhost:8002/health # Segment
curl http://localhost:8003/health # Advise
curl http://localhost:8004/health # GenerateSymptoms: OSError: [Errno 98] Address already in use or Port 8001 is already in use
Solutions:
Windows (PowerShell):
# Find process using port
netstat -ano | findstr :8001
# Kill specific process
taskkill /PID <PID> /F
# Kill all Python processes (caution!)
Get-Process python | Stop-Process -ForcemacOS/Linux:
# Find and kill process
lsof -ti:8001 | xargs kill -9
# Or use fuser
fuser -k 8001/tcp
# Or use netstat
netstat -nlp | grep :8001
kill -9 <PID>Symptoms: ModuleNotFoundError: No module named 'fastapi' or similar
Solutions:
# 1. Verify virtual environment is activated
which python # Should show venv path
# 2. Activate if not activated
# Windows
.\venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
# 3. Upgrade pip
python -m pip install --upgrade pip
# 4. Reinstall dependencies
pip install -r requirements.txt
# 5. For specific issues
pip install --force-reinstall fastapiSymptoms: FileNotFoundError: yolov8n.pt not found
Solutions:
YOLOv8 Model:
cd artistry-backend/detect/app
# Windows
curl -L https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt -o yolov8n.pt
# Or
wget https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.ptMobileSAM Model:
cd artistry-backend/segment/app
# Download from: https://github.com/ChaoningZhang/MobileSAM/releases
# Place mobile_sam.pt in this directorySymptoms: ServerSelectionTimeoutError or Connection refused
Common Causes & Fixes:
❌ IP Not Whitelisted
- Go to MongoDB Atlas → Network Access
- Add your IP or
0.0.0.0/0(allow all)
❌ Wrong Credentials
# Check connection string format
MONGO_URI = "mongodb+srv://username:password@cluster.mongodb.net/dbname?retryWrites=true&w=majority"❌ Network/Firewall Issues
- Check corporate firewall
- Try different network
- Test connection:
from motor.motor_asyncio import AsyncIOMotorClient
client = AsyncIOMotorClient("your-uri")
try:
client.admin.command('ping')
print("✅ Connected!")
except Exception as e:
print(f"❌ Failed: {e}")Symptoms: RuntimeError: CUDA out of memory or import errors
Solutions:
# Check PyTorch version
python -c "import torch; print(torch.__version__)"
# Check CUDA availability
python -c "import torch; print(torch.cuda.is_available())"
# Reinstall PyTorch (CPU version)
pip uninstall torch torchvision torchaudio
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
# For GPU (CUDA 11.8)
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118Symptoms: Access to fetch blocked by CORS policy
Solution:
Check each backend service's main.py:
from fastapi.middleware.cors import CORSMiddleware
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://127.0.0.1:5173"
],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)Then restart all services.
Symptoms: undefined values for import.meta.env.VITE_*
Solutions:
- Check
.envfile exists:frontend/.env - Verify all variables start with
VITE_:
VITE_GATEWAY_URL=http://localhost:8000
VITE_DETECT_URL=http://localhost:8001
# etc...- Restart dev server after .env changes
- Check in browser console:
console.log(import.meta.env.VITE_GATEWAY_URL)Symptoms: EACCES or EPERM errors
Solutions:
# Clear cache
npm cache clean --force
# Remove and reinstall
rm -rf node_modules package-lock.json
npm install
# Update npm
npm install -g npm@latest
# Use legacy peer deps (if conflicts)
npm install --legacy-peer-depsSymptoms: Broken images or Failed to load resource
Solutions:
// Check image data format
console.log(typeof imageData);
console.log(imageData?.substring(0, 50));
// Ensure proper base64 prefix
const imageSrc = imageData.startsWith('data:')
? imageData
: `data:image/jpeg;base64,${imageData}`;Causes: CPU-only inference, large images, high inference steps
Solutions:
- Reduce inference steps (in
generate/app/main.py):
DEFAULT_STEPS = 15 # Instead of 20-30- Resize images before upload (in frontend):
const maxSize = 1024; // Max width/height- Enable GPU (if available):
device = "cuda" if torch.cuda.is_available() else "cpu"Symptoms: System slowdown, OOM errors
Solutions:
# In each service's main.py
import torch
# For GPU
torch.cuda.empty_cache()
# Limit batch size
batch_size = 1
# Use float16 precision
model.half()Solutions:
# Add rate limiting
from slowapi import Limiter
limiter = Limiter(key_func=get_remote_address)
@app.post("/detect")
@limiter.limit("5/minute")
async def detect(file: UploadFile):
passSolutions:
# Check logs
docker-compose logs -f gateway
# Rebuild without cache
docker-compose down
docker-compose build --no-cache
docker-compose up -d
# Check container status
docker ps -aSolutions:
# Recreate network
docker network prune
docker-compose up --force-recreate
# Check network
docker network inspect artistry-networkBackend (main.py):
import logging
import sys
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s [%(levelname)s] %(name)s: %(message)s',
handlers=[
logging.StreamHandler(sys.stdout),
logging.FileHandler('service.log')
]
)Frontend (api.js):
const DEBUG = true;
const log = (...args) => {
if (DEBUG) console.log('[API]', ...args);
};
export const detectObjects = async (file) => {
log('Detecting:', file.name);
// ...
};- Check logs carefully for error details
- Search issues: GitHub Issues
- Ask for help: Discussions
- Email support: kush2012bhardwaj@gmail.com
When reporting issues, include:
- OS and version
- Python version (
python --version) - Node version (
node --version) - Complete error message
- Steps to reproduce
- Relevant logs (last 50 lines)