Troubleshooting¶
This guide helps you resolve common issues when using BMLibrarian.
Database Connection Issues¶
"Connection refused" or "Could not connect to server"¶
Symptoms:
psycopg.OperationalError: connection to server at "localhost" (127.0.0.1),
port 5432 failed: Connection refused
Solutions:
-
Check if PostgreSQL is running:
-
Verify connection parameters:
-
Check PostgreSQL configuration:
- Ensure
postgresql.confhaslisten_addressesconfigured - Check
pg_hba.conffor authentication settings
- Ensure
"Password authentication failed"¶
Solutions:
-
Verify credentials:
-
Check environment variables:
-
Reset password if needed:
"Database does not exist"¶
Solutions:
- For first-time setup, use
migrate initinstead ofmigrate apply - Create database manually:
Permission Issues¶
"Permission denied to create database"¶
Solutions:
-
Grant CREATEDB privilege:
-
Use superuser for initial setup:
"Permission denied for table"¶
Solutions:
GRANT ALL PRIVILEGES ON DATABASE bmlibrarian_dev TO your_username;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO your_username;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO your_username;
Ollama Issues¶
"Failed to connect to Ollama"¶
Symptoms:
Solutions:
-
Start Ollama:
-
Verify Ollama is running:
-
Check Ollama URL in configuration:
"Model not found"¶
Solutions:
-
List available models:
-
Pull required model:
-
Check model name in configuration matches exactly
Extension Issues¶
"Extension does not exist" (pgvector)¶
Solutions:
-
Install pgvector:
-
Enable extensions:
-
Check available extensions:
GUI Issues¶
Application Won't Start¶
Solutions:
-
Check Python version:
-
Verify dependencies:
-
Check logs:
-
Reset configuration:
No Tabs Appear¶
Solutions:
- Check configuration file exists
- Verify
enabled_pluginslist is not empty - Check logs for plugin loading errors
- Reset configuration to defaults
Theme Not Changing¶
Solutions:
- Restart the application (required for theme changes)
- Verify theme setting in configuration
- Check stylesheet files exist
UI Freezing¶
Solutions:
- Wait for operation to complete (background processing)
- Check Ollama is responding
- Check database query performance
- Restart application if frozen
Performance Issues¶
Slow Searches¶
Solutions:
-
Add database indexes:
-
Use faster models for initial testing
- Reduce search result limits
- Check database statistics:
Out of Memory¶
Solutions:
- Use smaller models (7B-8B parameters)
- Reduce
max_tokenssettings - Lower
batch_sizefor scoring - Process fewer documents at once
Environment Issues¶
"Environment variable not set"¶
Solutions:
-
Set required variables:
-
Use .env file:
"Module not found"¶
Solutions:
-
Install missing dependencies:
-
Activate virtual environment:
-
Reinstall package:
Debugging Tools¶
Useful Commands¶
# Check PostgreSQL version
psql --version
# Test database connection
psql -h localhost -U username -d database_name -c "SELECT version();"
# Check Python environment
pip list | grep -E "(bmlibrarian|psycopg)"
# List installed Ollama models
ollama list
# Check BMLibrarian logs
tail -f ~/.bmlibrarian/gui_qt.log
Enable Debug Logging¶
# CLI with debug output
uv run python bmlibrarian_cli.py --debug
# GUI with debug output
uv run python bmlibrarian_qt.py --debug
Getting Help¶
If these solutions don't resolve your issue:
- Check logs for detailed error messages
- Verify prerequisites are installed correctly
- Test with minimal configuration
- Create a test case to reproduce the issue
- Report issues at GitHub