Skip to content

[BUG] Basic Memory fails to install because of a database error #221

Description

@groksrc

Problem

Basic Memory requires SQLite's FTS5 (Full-Text Search version 5) extension for its search functionality, but doesn't check if FTS5 is available before attempting to use it. This causes failures on systems where SQLite is compiled without FTS5 support.

Current Behavior

  • The application attempts to create an FTS5 virtual table without checking availability
  • On systems without FTS5 support, this results in an error during database initialization
  • Users get a cryptic SQLite error instead of a clear message about the missing dependency

Proposed Solution

Add a startup check that:

  1. Tests if FTS5 is available in the current SQLite installation
  2. Provides a clear, actionable error message if FTS5 is missing

Implementation Details

The check could be added in src/basic_memory/db.py during database initialization:

def check_fts5_support(conn):
    """Check if SQLite has FTS5 support enabled."""
    try:
        conn.execute("CREATE VIRTUAL TABLE temp_fts5_check USING fts5(content)")
        conn.execute("DROP TABLE temp_fts5_check")
        return True
    except sqlite3.OperationalError as e:
        if "no such module: fts5" in str(e):
            return False
        raise

If FTS5 is not available, display an error like:

Error: SQLite FTS5 extension is not available.
Basic Memory requires SQLite with FTS5 support for search functionality.

Additional Considerations

  • Document the FTS5 requirement in README.md and installation guides
  • Consider adding this check to the test suite
  • Could potentially add a fallback search mechanism (though this would be a larger change)

Related Issues

This issue was discovered during testing of the basic-memory-installer on a fresh macOS VM where the system SQLite lacked FTS5 support.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions