-
Notifications
You must be signed in to change notification settings - Fork 2
Troubleshooting
This page covers common issues and their solutions.
Symptom:
sqlalchemy.exc.OperationalError: connection refused
Solutions:
-
Check if PostgreSQL is running:
docker compose ps postgres
-
Check the port in your
.env:# Port 5432 for both Full Docker and Hybrid modes DATABASE_URL=postgresql+asyncpg://ontokit:ontokit@localhost:5432/ontokit -
Wait for PostgreSQL to be ready:
docker compose logs -f postgres # Look for "database system is ready to accept connections"
Symptom:
redis.exceptions.ConnectionError: Connection refused
Solution:
docker compose up -d redis
docker compose logs redisSymptom:
OSError: [Errno 98] Address already in use
Solutions:
-
Find what's using the port:
lsof -i :8000 # or netstat -tlnp | grep 8000
-
Kill the process:
kill <PID>
-
Or use a different port:
uvicorn ontokit.main:app --port 8001
Symptom:
{"detail": "Token validation failed: ..."}Solutions:
-
Check Zitadel is running:
curl http://localhost:8080/debug/ready
-
Verify
ZITADEL_ISSUERin.envmatches Zitadel URL:ZITADEL_ISSUER=http://localhost:8080
-
Token may be expired - get a new one
-
Clear JWKS cache by restarting the API server
Symptom:
{"detail": "Not authenticated"}Solutions:
-
Ensure the
Authorizationheader is included:curl -H "Authorization: Bearer <token>" ... -
Check the token format (should be
Bearer <token>, not just<token>)
Symptom:
Access to fetch at 'http://localhost:8000/...' from origin 'http://localhost:3000'
has been blocked by CORS policy
Solution:
Add your frontend URL to CORS_ORIGINS in .env:
CORS_ORIGINS=["http://localhost:3000","http://localhost:3001"]Then restart the API server.
Symptom:
alembic.util.exc.CommandError: Can't locate revision identified by '...'
Solutions:
-
Check current revision:
alembic current
-
If database is ahead of code, downgrade:
alembic downgrade <target_revision>
-
If completely out of sync, reset:
# WARNING: This deletes all data docker compose down -v docker compose up -d alembic upgrade head
Symptom:
sqlalchemy.exc.ProgrammingError: relation "projects" already exists
Solution:
Stamp the database with the current revision:
alembic stamp headSymptom:
sqlalchemy.exc.ProgrammingError: column "new_column" does not exist
Solution:
Run pending migrations:
alembic upgrade headSymptom:
Internal Server ErrorSolutions:
-
Check the server logs in your terminal
-
Enable debug mode in
.env:DEBUG=true
-
Test the specific operation in Python:
import asyncio from ontokit.services.project_service import ProjectService # ... debug interactively
Symptom:
{
"detail": [
{
"loc": ["body", "name"],
"msg": "field required",
"type": "value_error.missing"
}
]
}Solution:
Check your request body matches the expected schema. See API Reference for required fields.
Symptom:
{"detail": "Not Found"}Solutions:
-
Restart the server to pick up new routes:
# Kill and restart uvicorn pkill -f uvicorn uvicorn ontokit.main:app --reload -
Check the router is registered in
ontokit/api/routes/ -
Verify the endpoint path is correct
Solution:
# Check logs for the failing container
docker compose logs zitadel
# Check health status
docker compose psSolution:
# Remove unused Docker resources
docker system prune -a
# Remove only unused volumes
docker volume pruneSolutions:
-
Check container is running:
docker compose ps
-
Check port mappings:
docker compose port postgres 5432
-
Check container logs:
docker compose logs <service>
Solutions:
-
Enable SQL logging:
DEBUG=true
-
Check for missing indexes
-
Use
EXPLAIN ANALYZEin psql:EXPLAIN ANALYZE SELECT * FROM projects WHERE owner_id = '...';
Solutions:
-
Check container resource usage:
docker stats
-
Limit container memory in
compose.yaml:services: postgres: deploy: resources: limits: memory: 512M
Symptom:
{"error":"invalid_request","error_description":"Errors.App.NotFound"}Solution:
The OAuth applications haven't been created in Zitadel. Run the setup script:
./scripts/setup-zitadel.sh --update-envThen recreate the API container: docker compose up -d --force-recreate api worker
Symptom: You enter credentials correctly but get a generic error.
Cause: Zitadel logs show Errors.User.GrantRequired - the project has role checking enabled but users don't have grants.
Solution:
Disable project role checking:
# Get admin PAT
docker cp ontokit-zitadel:/zitadel-data/admin.pat /tmp/admin.pat
PAT=$(cat /tmp/admin.pat)
# Get project ID
PROJECT_ID=$(curl -s -H "Authorization: Bearer $PAT" \
-X POST "http://localhost:8080/management/v1/projects/_search" \
-H "Content-Type: application/json" \
-d '{"queries":[{"nameQuery":{"name":"OntoKit","method":"TEXT_QUERY_METHOD_EQUALS"}}]}' \
| python3 -c "import sys, json; print(json.load(sys.stdin)['result'][0]['id'])")
# Disable role check
curl -X PUT "http://localhost:8080/management/v1/projects/$PROJECT_ID" \
-H "Authorization: Bearer $PAT" \
-H "Content-Type: application/json" \
-d '{"name": "OntoKit", "projectRoleAssertion": false, "projectRoleCheck": false}'Solutions:
-
Check Zitadel logs:
docker compose logs zitadel
-
Verify redirect URIs match exactly in Zitadel console
-
Clear browser cookies and try again
Solution:
Ensure you're logged in as admin and have the correct organization selected.
Symptom: Embedding generation shows "pending" indefinitely or job status shows failure.
Solutions:
-
Check the ARQ worker is running:
# In Full Docker mode docker compose logs worker # In Hybrid mode, start the worker manually: uv run arq ontokit.worker.WorkerSettings
-
Check Redis is available:
docker exec ontokit-redis redis-cli ping -
For OpenAI/Voyage providers, verify the API key is set in the embedding config via the API endpoint.
Symptom: Normalization job returns error status.
Solutions:
-
Check worker logs for the specific error:
docker compose logs worker | grep normalization -
Ensure the ontology file is valid Turtle/RDF by checking the lint endpoint first.
Symptom: Jobs stay in "pending" state.
Solutions:
-
Verify the worker container is running:
docker compose ps worker
-
Check Redis connection:
docker compose logs worker | grep redis -
Restart the worker:
docker compose restart worker
Symptom: Semantic search or duplicate detection returns errors about pgvector.
Solution:
The pgvector extension must be installed in your PostgreSQL instance. The Docker Compose setup includes it by default. If using an external PostgreSQL:
CREATE EXTENSION IF NOT EXISTS vector;Symptom: Embedding generation fails with API errors.
Solutions:
- For OpenAI: Verify your API key is valid and has sufficient credits
- For Voyage: Verify your API key and model name
- For local (sentence-transformers): Ensure sufficient memory for model loading (~500MB)
- Check the embedding config:
GET /api/v1/projects/{id}/embeddings/config
If you can't resolve an issue:
- Check the FastAPI documentation
- Check the SQLAlchemy documentation
- Search existing GitHub issues
- Create a new issue with:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Error messages/logs
- Environment details (OS, Python version, etc.)
docker compose restart
pkill -f uvicorn
uvicorn ontokit.main:app --reloaddocker compose down -v
docker compose up -d
# Reconfigure Zitadel applications and update .env files
./scripts/setup-zitadel.sh --update-env
# Recreate API/worker containers for new credentials
docker compose up -d --force-recreate api worker
# Run migrations
docker compose exec api alembic upgrade headdocker compose logs -f# API
curl http://localhost:8000/health
# Zitadel
curl http://localhost:8080/debug/ready
# PostgreSQL
docker exec ontokit-postgres pg_isready
# Redis
docker exec ontokit-redis redis-cli ping