Troubleshooting Guide¶
This guide helps you diagnose and resolve common issues with the Code Graph Knowledge System.
Table of Contents¶
- Quick Diagnostics
- Connection Issues
- Docker Deployment Issues
- Neo4j Problems
- LLM Provider Issues
- Performance Problems
- Memory Issues
- MCP Server Problems
- API Errors
- Installation Issues
- Data and Storage Issues
- Common Error Messages
Quick Diagnostics¶
Health Check¶
Start with the health check endpoint:
Healthy Response:
Unhealthy Response:
{
"status": "unhealthy",
"neo4j": "disconnected",
"llm_provider": "error",
"error": "Connection timeout"
}
System Check Command¶
# Check all services
python -m codebase_rag --check
# Check logs
tail -f logs/application.log
# Check Docker containers
docker ps -a
docker logs code-graph-api
docker logs code-graph-neo4j
Common Issues Quick Reference¶
| Symptom | Likely Cause | Quick Fix |
|---|---|---|
| Application won't start | Missing dependencies | uv pip install -e . |
| Connection timeout | Neo4j not running | docker-compose up -d neo4j |
| 502 Bad Gateway | Service crashed | Check logs, restart service |
| Slow responses | Memory/CPU limits | Increase Docker resources |
| Import errors | Wrong Python path | export PYTHONPATH=$PWD |
| API 500 errors | Configuration issue | Check .env file |
Connection Issues¶
Neo4j Connection Timeout¶
Symptom:
Diagnosis:
# Check if Neo4j is running
docker ps | grep neo4j
# or
sudo systemctl status neo4j
# Try connecting manually
docker exec -it code-graph-neo4j cypher-shell -u neo4j -p yourpassword
Solutions:
-
Neo4j not running:
-
Wrong connection details:
-
Neo4j not ready yet:
-
Firewall blocking connection:
-
Docker network issues:
Ollama Connection Failed¶
Symptom:
Diagnosis:
Solutions:
-
Ollama not running:
-
Model not downloaded:
-
Wrong Ollama URL:
OpenAI API Connection Issues¶
Symptom:
Solutions:
-
Invalid API key:
-
Network connectivity:
-
Rate limiting:
Docker Deployment Issues¶
Container Won't Start¶
Symptom:
Diagnosis:
Common Issues:
-
Missing environment variables:
-
Port already in use:
-
Out of disk space:
-
Memory limits:
Docker Compose Errors¶
Error: "Version is not supported"
# Update Docker Compose
sudo apt-get update
sudo apt-get install docker-compose-plugin
# Or use docker compose (without hyphen)
docker compose up -d
Error: "Network not found"
Error: "Volume not found"
Container Networking Issues¶
Containers can't communicate:
# Check network
docker network ls
docker network inspect code-graph_default
# Ensure containers are on same network
docker-compose ps
# Test connectivity
docker exec code-graph-api ping neo4j
DNS resolution fails:
# Use service name, not localhost
NEO4J_URI=bolt://neo4j:7687 # Correct in Docker
NEO4J_URI=bolt://localhost:7687 # Wrong in Docker
Neo4j Problems¶
Neo4j Out of Memory¶
Symptom:
Solutions:
-
Increase heap size:
-
Clear old data:
-
Optimize queries:
Neo4j Browser Not Accessible¶
Symptom: Cannot access http://localhost:7474
Solutions:
-
Check port mapping:
-
Neo4j not ready:
-
Firewall blocking:
APOC Plugin Issues¶
Symptom:
Solutions:
-
APOC not installed:
-
Restart Neo4j:
-
Verify APOC:
Neo4j Authentication Failed¶
Symptom:
Solutions:
# Reset password
docker exec -it code-graph-neo4j cypher-shell -u neo4j -p neo4j
# Follow prompts to change password
# Update .env
NEO4J_PASSWORD=new-password
# Restart application
docker-compose restart api
LLM Provider Issues¶
Ollama Model Not Found¶
Symptom:
Solutions:
# List available models
ollama list
# Pull required model
ollama pull llama3.2:3b
ollama pull nomic-embed-text
# Verify in .env
OLLAMA_MODEL=llama3.2:3b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
Ollama Out of Memory¶
Symptom:
Solutions:
-
Use smaller model:
-
Increase system memory:
- Close other applications
- Increase Docker memory limit
-
Use smaller context window
-
Use CPU offloading:
OpenAI Rate Limit Exceeded¶
Symptom:
Solutions:
-
Wait and retry:
-
Upgrade OpenAI plan:
- Visit OpenAI dashboard
- Increase rate limits
-
Add payment method
-
Switch to Ollama:
Gemini API Quota Exceeded¶
Symptom:
Solutions:
- Check quota:
- Visit Google AI Studio
- Check daily quota usage
-
Wait for quota reset (midnight Pacific)
-
Request quota increase:
- Contact Google support
- Upgrade to paid plan
Performance Problems¶
Slow Query Responses¶
Symptom: Queries take > 30 seconds
Diagnosis:
# Check system resources
top
htop
docker stats
# Check Neo4j query performance
# In Neo4j Browser, run with PROFILE:
PROFILE MATCH (n:Document) RETURN n LIMIT 10
Solutions:
-
Add Neo4j indexes:
-
Optimize chunk size:
-
Use smaller embedding model:
-
Increase timeouts:
High Memory Usage¶
Symptom:
Solutions:
-
Increase Docker memory:
-
Reduce Neo4j memory:
-
Process documents in batches:
-
Clear cache:
High CPU Usage¶
Symptom: CPU at 100% constantly
Solutions:
-
Check what's consuming CPU:
-
Ollama consuming CPU:
-
Limit concurrent operations:
Memory Issues¶
Memory Store Search Slow¶
Symptom: Memory search takes > 5 seconds
Solutions:
-
Add fulltext index:
-
Limit search results:
-
Filter by importance:
Memory Not Found After Adding¶
Symptom: Memory added successfully but search doesn't find it
Diagnosis:
// Check if memory exists
MATCH (m:Memory {project_id: "your-project"})
RETURN m LIMIT 10
// Check memory count
MATCH (m:Memory {project_id: "your-project"})
RETURN count(m)
Solutions:
-
Index not updated:
-
Search query too specific:
-
Project ID mismatch:
MCP Server Problems¶
MCP Server Won't Start¶
Symptom:
Diagnosis:
# Try starting manually
python -m codebase_rag --mcp
# Check logs
python -m codebase_rag --mcp 2>&1 | tee mcp.log
Solutions:
-
Missing MCP package:
-
Port already in use:
-
Neo4j not accessible:
MCP Tools Not Appearing in Claude¶
Symptom: MCP tools don't show up in Claude Desktop
Solutions:
-
Check Claude config:
-
Check MCP server path:
-
Restart Claude Desktop:
-
Check Python environment:
MCP Tool Execution Fails¶
Symptom:
Solutions:
-
Increase timeouts:
-
Check Neo4j connection:
-
Check file paths:
API Errors¶
500 Internal Server Error¶
Diagnosis:
Common Causes:
-
Configuration error:
-
Database connection lost:
-
Unhandled exception:
422 Validation Error¶
Symptom:
{
"detail": [
{
"loc": ["body", "memory_type"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Solution: Check your request body includes all required fields.
Example correct request:
curl -X POST http://localhost:8000/api/v1/memory/add \
-H "Content-Type: application/json" \
-d '{
"project_id": "myapp",
"memory_type": "decision",
"title": "Use PostgreSQL",
"content": "Selected PostgreSQL as database",
"importance": 0.8
}'
404 Not Found¶
Diagnosis:
Solutions:
-
Check API version:
-
Check URL spelling:
Installation Issues¶
uv Installation Fails¶
Symptom:
Solution:
# Install curl first
sudo apt-get install curl # Debian/Ubuntu
brew install curl # macOS
# Then install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
Python Version Issues¶
Symptom:
Solutions:
# Check Python version
python --version
# Install Python 3.13
## Ubuntu/Debian
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.13
## macOS
brew install python@3.13
# Create venv with correct Python
python3.13 -m venv .venv
source .venv/bin/activate
Dependency Installation Fails¶
Symptom:
Solutions:
-
Install build dependencies:
-
Clear cache and retry:
-
Use pre-built wheels:
Data and Storage Issues¶
Disk Space Full¶
Symptom:
Solutions:
# Check disk space
df -h
# Clean up Docker
docker system prune -a
docker volume prune
# Clean up Neo4j data (CAUTION: deletes all data)
docker-compose down -v
docker-compose up -d
# Clean up logs
rm -rf logs/*.log.*
Data Corruption¶
Symptom:
Solutions:
-
Backup and restore:
-
Check disk health:
Common Error Messages¶
"Cannot connect to Neo4j"¶
- Check Neo4j is running:
docker ps | grep neo4j - Check connection string in
.env - Check network connectivity
"LLM provider not configured"¶
- Set
LLM_PROVIDERin.env - Install provider (Ollama/OpenAI/Gemini)
- Download models if using Ollama
"Memory not found"¶
- Check project_id is correct
- Verify memory exists:
MATCH (m:Memory) RETURN m - Rebuild search index
"Operation timeout"¶
- Increase timeout in
.env - Check system resources
- Process smaller documents
"Permission denied"¶
- Check file permissions:
ls -la - Fix with:
chmod +x start.py - Check Docker permissions: Add user to docker group
"Module not found"¶
- Install dependencies:
uv pip install -e . - Check virtual environment is activated
- Set PYTHONPATH:
export PYTHONPATH=$PWD
Getting More Help¶
Collect Diagnostic Information¶
When reporting issues, include:
# System information
uname -a
python --version
docker --version
# Application logs
docker logs code-graph-api > api.log
docker logs code-graph-neo4j > neo4j.log
# Configuration (remove sensitive data!)
cat .env | sed 's/PASSWORD=.*/PASSWORD=REDACTED/'
# Neo4j information
# In Neo4j Browser:
CALL dbms.components()
CALL apoc.version()
Where to Get Help¶
- Documentation: https://code-graph.vantagecraft.dev
- GitHub Issues: Search existing issues or create new one
- GitHub Discussions: Ask questions
- Discord/Slack: Community chat (if available)
Creating a Good Bug Report¶
Include:
- Environment: OS, Python version, deployment mode
- Steps to reproduce: Exact commands and actions
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Logs: Relevant error messages and stack traces
- Configuration: Sanitized
.envfile contents - Attempts to fix: What you've already tried
Example Bug Report Template¶
## Environment
- OS: Ubuntu 22.04
- Python: 3.13.1
- Deployment: Docker Compose
- Version: 0.7.0
## Issue
Memory search returns no results despite having memories in database.
## Steps to Reproduce
1. Add memory: `curl -X POST ...`
2. Search memory: `curl -X POST ...`
3. Gets empty result: `{"memories": []}`
## Expected Behavior
Should return the memory added in step 1.
## Logs
Attempts to Fix¶
- Restarted Neo4j: No change
- Checked memory exists: Confirmed with Cypher query
- Rebuilt index: Same error ```
Need Immediate Help?¶
For critical production issues:
- Check Status Page (if available)
- Rollback to previous version
- Enable debug logging:
LOG_LEVEL=DEBUG - Contact maintainers directly
- Post in #urgent channel (if community exists)
Remember: Most issues are configuration-related. Double-check your .env file and ensure all services are running!