Troubleshooting
This guide helps you diagnose and fix common issues with Codex.
Quick Diagnostics
Before diving into specific issues, run these checks:
Health Check
curl http://localhost:8080/health
Expected: {"status":"ok"}
View Logs
# Docker
docker compose logs --tail=100 codex
# Systemd
journalctl -u codex --since "1 hour ago"
# Binary (if file logging enabled)
tail -f /var/log/codex/codex.log
Check Configuration
# Docker
docker compose exec codex cat /app/config/config.docker.yaml
# Verify environment variables
docker compose exec codex env | grep CODEX
Server Issues
Server Won't Start
Symptoms
- Service fails to start
- Exit immediately after starting
- "Address already in use" error
Solutions
-
Check port availability:
lsof -i :8080
# Kill conflicting process or change port -
Verify configuration:
# Check for YAML syntax errors
cat codex.yaml | python -c "import yaml,sys; yaml.safe_load(sys.stdin)" -
Check database path:
# For SQLite, ensure directory exists
mkdir -p ./data -
Check permissions:
# Ensure user can write to data directory
ls -la ./data
Slow Performance
Symptoms
- Slow page loads
- API requests timeout
- High CPU/memory usage
Solutions
-
Check resource usage:
docker stats codex
# or
htop -
Reduce concurrent scans:
scanner:
max_concurrent_scans: 1 -
Check database performance:
# PostgreSQL
docker compose exec postgres psql -U codex -c "SELECT count(*) FROM books;" -
Enable debug logging temporarily:
CODEX_LOGGING_LEVEL=debug docker compose up
Server Hanging on Restart
Symptoms
- Container takes 10+ seconds to stop
- Frontend reloads slowly (30-60 seconds)
- Ctrl+C doesn't stop server immediately
Root Cause
This was fixed in recent versions. If you experience this:
-
Update to latest version:
git pull
docker compose build
docker compose up -d -
Verify graceful shutdown:
docker compose logs | grep -i "shutdown"You should see:
Received SIGTERM signal
Starting graceful shutdown...
Task worker shut down successfully
Shutdown complete
Database Issues
Connection Failed
Symptoms
- "Connection refused" error
- "Database not found" error
- Timeout connecting to database
Solutions
PostgreSQL:
-
Check database is running:
docker compose exec postgres pg_isready -U codex -
Verify connection settings:
database:
db_type: postgres
postgres:
host: postgres # Docker service name
port: 5432
username: codex
password: codex
database_name: codex -
Check network connectivity:
docker compose exec codex ping postgres
SQLite:
-
Check file permissions:
ls -la ./data/codex.db -
Check directory is writable:
touch ./data/test && rm ./data/test
Database Locked (SQLite)
Symptoms
- "database is locked" errors
- Operations fail intermittently
- Scan hangs
Solutions
-
Don't run separate workers with SQLite: SQLite cannot handle concurrent writes from multiple processes.
-
Use WAL mode (recommended):
database:
sqlite:
pragmas:
journal_mode: WAL -
Reduce concurrent operations:
scanner:
max_concurrent_scans: 1
task:
worker_count: 2 -
Consider PostgreSQL for multi-user environments.
Migration Errors
Symptoms
- "Migration failed" on startup
- Database schema errors
- Missing columns/tables
Solutions
-
Check migration status:
docker compose exec codex codex migrate --config /app/config/config.docker.yaml -
Backup and reset (development only):
# Backup
pg_dump -U codex codex > backup.sql
# Reset
docker compose down -v
docker compose up -d
Library & Scanning Issues
Library Not Found
Symptoms
- "Path does not exist" error
- Library shows 0 books
- Scan fails immediately
Solutions
-
Check path exists (Docker):
docker compose exec codex ls -la /library -
Verify volume mount:
volumes:
- /your/actual/path:/library:ro -
Check permissions:
# The codex user needs read access
ls -la /your/actual/path
Scan Not Finding Files
Symptoms
- Scan completes with 0 books
- Files exist but aren't detected
- Some formats not recognized
Solutions
-
Check file extensions: Supported:
.cbz,.cbr,.epub,.pdf -
Verify files aren't corrupted:
file /library/somebook.cbz
unzip -t /library/somebook.cbz -
Check scan logs:
docker compose logs codex | grep -i "scan\|error" -
Try deep scan:
curl -X POST "http://localhost:8080/api/v1/libraries/{id}/scan?mode=deep" \
-H "Authorization: Bearer $TOKEN"
Scan Taking Too Long
Symptoms
- Scan running for hours
- Progress stuck at certain percentage
- High disk I/O
Solutions
-
Check library size: Large libraries (10,000+ books) take time on first scan.
-
Monitor the Task Queue: Go to Settings > Tasks to view active and pending tasks.

-
Use normal scan for updates: Deep scans re-process everything.
-
Check disk I/O:
iostat -x 1 -
Reduce concurrent scans:
scanner:
max_concurrent_scans: 1
Metadata Not Extracted
Symptoms
- Books show with wrong titles
- Series not detected
- Missing author/publisher info
Solutions
-
Add ComicInfo.xml to comics:
<?xml version="1.0"?>
<ComicInfo>
<Title>Issue Title</Title>
<Series>Series Name</Series>
<Number>1</Number>
</ComicInfo> -
Run deep scan to re-extract:
curl -X POST "http://localhost:8080/api/v1/libraries/{id}/scan?mode=deep" \
-H "Authorization: Bearer $TOKEN" -
Check filename format:
Series Name 001.cbzis better thanrandom_name.cbz
Authentication Issues
Login Failed
Symptoms
- "Invalid credentials" error
- Can't log in after setup
- Token expired errors
Solutions
-
Verify credentials (case-sensitive):
curl -X POST http://localhost:8080/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"yourpassword"}' -
Reset password (via admin):
curl -X PUT http://localhost:8080/api/v1/users/{id} \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-d '{"password":"newpassword"}' -
Check JWT secret is set:
auth:
jwt_secret: "your-secret-here" # Must be set!
API Key Not Working
Symptoms
- "Unauthorized" with valid key
- Key works in curl but not in app
- Permissions denied
Solutions
-
Check key format:
# As header
curl -H "Authorization: Bearer codex_abc123..."
# As X-API-Key
curl -H "X-API-Key: codex_abc123..." -
Verify key permissions: Keys can only have permissions the creator has.
-
Check key isn't revoked:
curl http://localhost:8080/api/v1/api-keys \
-H "Authorization: Bearer $TOKEN"
SSE (Real-Time Updates) Issues
Events Not Received
Symptoms
- Progress not updating in real-time
- Scan status shows "unknown"
- No notifications for new books
Solutions
-
Check SSE connection (browser DevTools):
- Network tab > filter "stream"
- Status should be 200 (pending)
-
Verify authentication: SSE streams require valid auth token.
-
Check reverse proxy config:
# Nginx - disable buffering for SSE
proxy_buffering off;
proxy_cache off;
SSE Disconnecting Frequently
Symptoms
- Connection drops every 30 seconds
- "Reconnecting..." messages
- Inconsistent updates
Solutions
-
Extend timeout in reverse proxy:
proxy_read_timeout 86400s;
proxy_send_timeout 86400s; -
Check keep-alive settings: Codex sends keep-alive every 15 seconds.
-
Update to latest version: Recent fixes improved SSE reliability.
Docker Issues
Container Won't Start
Symptoms
- Container restarts repeatedly
- "Exited with code 1"
- Health check failing
Solutions
-
Check logs:
docker compose logs codex -
Verify dependencies:
docker compose ps
# postgres should be healthy before codex starts -
Check resources:
docker system df
# Ensure disk space available
Port Conflicts
Symptoms
- "Port already in use"
- Can't access Codex
Solutions
-
Find conflicting process:
lsof -i :8080
lsof -i :5432 -
Change ports in docker-compose:
ports:
- "8081:8080" # Map to different host port
Volume Permission Issues
Symptoms
- "Permission denied" errors
- Can't write to data directory
- Scan can't read files
Solutions
-
Check host permissions:
ls -la /path/to/library -
Run as correct user (Linux):
services:
codex:
user: "1000:1000" # Match host user
Frontend Issues
Page Not Loading
Symptoms
- Blank page
- JavaScript errors
- API calls failing
Solutions
-
Check API is responding:
curl http://localhost:8080/api/v1/auth/me \
-H "Authorization: Bearer $TOKEN" -
Clear browser cache: Hard refresh: Ctrl+Shift+R
-
Check browser console for errors.
Images Not Loading
Symptoms
- Covers show placeholder
- Pages don't display
- 404 errors for images
Solutions
-
Check thumbnail directory:
ls -la ./data/thumbnails/ -
Verify file permissions: Codex needs write access to thumbnail cache.
-
Regenerate thumbnails: Run a scan to regenerate missing thumbnails.
Getting Help
If you're still experiencing issues:
Check Server Metrics
Go to Settings > Metrics to view server statistics including inventory counts and task history.


Gather Information
-
Codex version:
codex --version -
Full logs:
docker compose logs > codex-logs.txt -
Configuration (redact secrets):
cat codex.yaml -
System info:
docker version
uname -a
Report Issues
- GitHub Issues
- Include:
- Steps to reproduce
- Expected vs actual behavior
- Logs and configuration
- System information