-
Notifications
You must be signed in to change notification settings - Fork 0
Troubleshooting
Last Updated: September 23, 2025 1:48 PM EST
Common issues and solutions for the SQLite MCP Server.
Issue: "no such function: jsonb"
Cause: Your SQLite version doesn't support JSONB (requires 3.45.0+)
// Check SQLite version
read_query({"query": "SELECT sqlite_version()"})Solution: Update SQLite or use legacy JSON functions.
Issue: "Invalid JSON in column"
Cause: The JSON string is malformed
// Use JSON Helper Tools for automatic validation
json_validate_security({"json_data": jsonString})Issue: "JSON parse error"
Cause: JSON syntax is incorrect
// β Incorrect: Single quotes
{'key': 'value'}
// β
Correct: Double quotes
{"key": "value"}Solution: Use JSON Helper Tools which automatically fix common formatting issues.
Issue: Queries being blocked or rejected Cause: Security protection is working correctly
# Test security protection
cd tests && python test_sql_injection.pyExpected Behavior: Critical injection vectors should be blocked.
Issue: Parameters not being substituted correctly Cause: Incorrect parameter format or count
// β
Correct parameter binding
read_query({
"query": "SELECT * FROM users WHERE id = ? AND status = ?",
"params": [123, "active"]
})
// β Incorrect: Parameter count mismatch
read_query({
"query": "SELECT * FROM users WHERE id = ? AND status = ?",
"params": [123] // Missing second parameter
})Issue: "database is locked"
Cause: Another connection is holding the database lock
Solutions:
- Check for long-running transactions in other processes
- Ensure proper connection cleanup
- Use WAL mode for better concurrency:
pragma_settings({
"pragma_name": "journal_mode",
"value": "WAL"
})Issue: Cannot access database file Cause: Insufficient file system permissions
Solutions:
- Check file permissions:
ls -la database.db - Ensure directory is writable
- For Docker: Check volume mount permissions
Issue: "Error during rollback"
Cause: Problem occurred during transaction rollback
Solutions:
- Check database integrity:
integrity_check() - Restart the MCP server if persistent
- Restore from backup if necessary
Issue: Operations hanging or timing out Cause: Circular dependency between transactions
Solutions:
- Use shorter transactions
- Access tables in consistent order
- Implement retry logic with exponential backoff
Issue: "foreign key constraint failed"
Cause: Attempted to violate a foreign key constraint
Solutions:
- Verify the referenced record exists:
read_query({
"query": "SELECT id FROM parent_table WHERE id = ?",
"params": [parent_id]
})- Use proper cascading delete:
create_table({
"query": `CREATE TABLE child_table (
id INTEGER PRIMARY KEY,
parent_id INTEGER,
FOREIGN KEY (parent_id) REFERENCES parent_table(id) ON DELETE CASCADE
)`
})Issue: Foreign keys not being enforced Cause: Foreign key support not enabled
Solution:
pragma_settings({
"pragma_name": "foreign_keys",
"value": "ON"
})Issue: Queries taking too long to execute Cause: Missing indexes or inefficient queries
Solutions:
- Analyze query performance:
read_query({
"query": "EXPLAIN QUERY PLAN SELECT * FROM large_table WHERE column = ?",
"params": ["value"]
})- Create appropriate indexes:
write_query({
"query": "CREATE INDEX idx_column ON large_table(column)"
})- Update database statistics:
analyze_database()Issue: Database operations becoming slow Cause: Database fragmentation or large size
Solutions:
- Vacuum the database:
vacuum_database()- Check database statistics:
database_stats()- Consider partitioning large tables or archiving old data
Issue: Full-text search not working Cause: FTS5 table not properly configured
Solutions:
- Verify FTS5 table exists:
list_virtual_tables()- Rebuild FTS index:
rebuild_fts_index({
"table_name": "documents_fts"
})Issue: Semantic search returning poor results Cause: Embeddings not properly stored or indexed
Solutions:
- Check embeddings table structure:
describe_table({"table_name": "embeddings_table"})- Verify embedding dimensions match:
read_query({
"query": "SELECT LENGTH(embedding) FROM embeddings_table LIMIT 1"
})- Rebuild vector index:
rebuild_vector_index({
"table_name": "embeddings_table"
})Issue: Container fails to start Cause: Various Docker-related issues
Solutions:
- Check Docker logs:
docker logs <container_id>- Verify volume mounts:
docker run -i --rm \
-v $(pwd):/workspace \
writenotenow/sqlite-mcp-server:latest \
--db-path /workspace/sqlite_mcp.db- Ensure database file permissions are correct
Issue: Database changes not persisting Cause: Incorrect volume mount configuration
Solution: Ensure proper volume mounting:
# Correct volume mount
docker run -v /host/path:/workspace writenotenow/sqlite-mcp-server:latest
# Check mount inside container
docker exec -it <container> ls -la /workspaceIssue: Tests failing unexpectedly Cause: Environment or dependency issues
Solutions:
- Check test environment:
python test_runner.py --quick- Verify dependencies:
pip list | grep -E "(mcp|sqlite)"- Run specific test categories:
python test_runner.py --json # JSON helper tools
python test_runner.py --security # Security featuresIssue: Features not working as expected Cause: Version mismatch between components
Solutions:
- Check all versions:
pragma_compile_options() // SQLite features- Verify MCP server version:
python start_sqlite_mcp.py --versionIssue: MCP client cannot connect to server Cause: Incorrect configuration
Solutions:
- Verify configuration format:
{
"mcpServers": {
"sqlite-mcp-server": {
"command": "python",
"args": [
"/path/to/sqlite-mcp-server/start_sqlite_mcp.py",
"--db-path", "/path/to/database.db"
]
}
}
}- Check file paths are absolute
- Verify Python environment has required packages
Issue: Server not finding required dependencies Cause: Python environment not properly configured
Solutions:
- Activate correct virtual environment
- Install requirements:
pip install -r requirements.txt- For development:
pip install -e .Issue: Database integrity check fails Cause: Database file corruption
Solutions:
- Check integrity:
integrity_check()- Attempt repair:
sqlite3 database.db ".recover" > recovered.sql
sqlite3 new_database.db < recovered.sql- Restore from backup:
restore_database({
"backup_path": "./backups/latest_backup.db",
"confirm": true
})Issue: Multiple system failures Cause: Various cascading issues
Recovery Steps:
- Stop all processes
- Backup current state (even if corrupted)
- Restore from known good backup
- Verify integrity
- Run comprehensive tests
- Gradually restore functionality
- Run diagnostics:
python test_runner.py --quick
cd tests && python test_sql_injection.py- Collect system information:
pragma_compile_options() // SQLite capabilities
database_stats() // Database status- Check logs for error messages and stack traces
When reporting issues, include:
- SQLite MCP Server version
- SQLite version (
SELECT sqlite_version()) - Python version
- Operating system
- Complete error messages
- Minimal reproduction steps
- Expected vs actual behavior
- GitHub Issues - Bug reports and feature requests
- Documentation - Complete documentation
- Testing Guide - Testing procedures
π§ Pro Tip: Most issues can be resolved by running the comprehensive test suite and following the error messages. The server includes extensive diagnostics to help identify problems quickly.