mvanhorn/last30days-skill · warning · LibrarySearchUnavailable

library search requires a Python SQLite build with FTS5 supp

Error message

library search requires a Python SQLite build with FTS5 support

What it means

Raised by sync_library in library_index.py as LibrarySearchUnavailable when fts5_available() returns False at entry — i.e. the interpreter's sqlite3 module was built without FTS5 full-text search support. Library search is implemented as an SQLite FTS5 index, so the feature is hard-unavailable on such builds; the dedicated exception type lets callers degrade gracefully instead of crashing.

Source

Thrown at skills/last30days/scripts/lib/library_index.py:109

def fts5_available() -> bool:
    try:
        with sqlite3.connect(":memory:") as conn:
            conn.execute("CREATE VIRTUAL TABLE probe USING fts5(value)")
    except sqlite3.DatabaseError:
        return False
    return True


def sync_library(
    memory_dir: Path | str = library.DEFAULT_MEMORY_DIR,
    briefs_dir: Path | str = library.DEFAULT_BRIEFS_DIR,
    *,
    db_path: Path | str = DEFAULT_LIBRARY_DB,
) -> SyncResult:
    """Incrementally index the shared ``scan_library`` view of saved research."""
    if not fts5_available():
        raise LibrarySearchUnavailable(
            "library search requires a Python SQLite build with FTS5 support"
        )
    target = Path(db_path).expanduser()
    try:
        return _sync_library(memory_dir, briefs_dir, target)
    except sqlite3.DatabaseError as exc:
        if "fts5" in str(exc).lower() and "malformed" not in str(exc).lower():
            raise LibrarySearchUnavailable(
                "library search requires a Python SQLite build with FTS5 support"
            ) from exc
        if not _is_confirmed_corruption(exc):
            raise
        _remove_database(target)
        return replace(_sync_library(memory_dir, briefs_dir, target), rebuilt=True)


def index_brief(
    path: Path | str,

View on GitHub (pinned to c7460f6114)

Solutions

  1. Use a Python/SQLite build with FTS5: official python.org builds and most conda/uv pythons include it; on Debian/Ubuntu ensure libsqlite3 is full-featured; on Alpine use a build with SQLITE_ENABLE_FTS5.
  2. Catch LibrarySearchUnavailable and skip/notify rather than fail the whole run — scan_library (plain listing) works without FTS5.
  3. Confirm the diagnosis first: python -c "import sqlite3;print(sqlite3.sqlite_version)" plus the CREATE VIRTUAL TABLE probe above.

Example fix

# before
from last30days.scripts.lib.library_index import sync_library
sync_library()

# after
from last30days.scripts.lib.library_index import sync_library, LibrarySearchUnavailable
try:
    sync_library()
except LibrarySearchUnavailable:
    print("library search disabled: this Python lacks SQLite FTS5")
Defensive patterns

Strategy: try-catch

Validate before calling

import sqlite3

def fts5_available() -> bool:
    try:
        conn = sqlite3.connect(":memory:")
        conn.execute("CREATE VIRTUAL TABLE probe USING fts5(x)")
        conn.close()
        return True
    except sqlite3.Error:
        return False

Try / catch

from skills.last30days.scripts.lib.library_index import sync_library, LibrarySearchUnavailable

try:
    sync_library(memory_dir, briefs_dir)
except LibrarySearchUnavailable:
    logging.warning("library search disabled on this Python (no SQLite FTS5); listing still works")

Prevention

When it happens

Trigger: Calling sync_library / the library-search command on Python builds where FTS5 was not compiled in: some distro Pythons, minimal/stripped SQLite builds, older Python versions, or systems linking against a system libsqlite3 without FTS5. Verify with: python -c "import sqlite3; c=sqlite3.connect(':memory:'); c.execute('CREATE VIRTUAL TABLE t USING fts5(x)')".

Common situations: Alpine/BusyBox-based containers with a lean sqlite; macOS system Python variants; corporate images with a custom-compiled SQLite; upgrading the OS swapped the linked libsqlite3 to one without FTS5.

Related errors


AI-assisted analysis of mvanhorn/last30days-skill@c7460f6114 (2026-08-15). Data as JSON: /api/errors/9ae4f948f70b2ac3. Report an issue: GitHub.