Repository navigation
Description
Environment
- Hermes version: v0.16.0 (2026.6.5)
- SQLite: any build that ships fts5 but lacks the optional
trigramtokenizer (e.g. SQLite 3.26, or stripped-down distros)
Description
Starting from v0.16.0, SessionDB.__init__() aborts on these SQLite builds. The session DB becomes unusable, and any tool that opens a session (including session_search) fails with a raw OperationalError.
Steps to reproduce
On a Python/SQLite runtime that does not have the trigram tokenizer, run hermes. The first SessionDB() open raises:
sqlite3.OperationalError: no such tokenizer: trigram
In tests, the bug reproduces with a cursor mock that raises this error on trigram DDL:
class _NoTrigramCursor(sqlite3.Cursor):
def executescript(self, sql_script):
if "tokenize='trigram'" in sql_script:
raise sqlite3.OperationalError("no such tokenizer: trigram")
return super().executescript(sql_script)Root cause
hermes_state.py:_is_fts5_unavailable_error only matches the whole-module absence case:
return "no such module" in err and "fts5" in errThe trigram DDL raises "no such tokenizer: trigram" instead, which does not match. The error propagates out of _ensure_fts_schema and aborts __init__.
The trigram table is documented as optional relative to the base fts5 table, but the matcher does not catch this per-tokenizer failure mode.
Suggested fix
Extend the matcher:
@staticmethod
def _is_fts5_unavailable_error(exc):
err = str(exc).lower()
if "no such module" in err and "fts5" in err:
return True
if "no such tokenizer" in err: # trigram etc.
return True
return FalseOut of scope (separate consideration)
The trigram failure path also calls _warn_fts5_unavailable, which flips self._fts_enabled = False after the base fts5 table has been successfully created. That globally disables full-text search even though the base path is still usable. Fixing that likely needs a separate capability probe (e.g. inside _ensure_fts_schema), not a one-line matcher change — flagging it here so the matcher fix is not assumed to fully solve the symptom on its own.
Activity
alt-glitch commentedon Jun 16, 2026
Related: #35931 (open PR implementing this exact matcher fix — recognizes "no such tokenizer" alongside "no such module: fts5"), #41033 / #41030 (trigram capability surfacing). Verified the bug is still live on
main:hermes_state.py:_is_fts5_unavailable_erroronly matches"no such module" in err and "fts5" in err, so the trigramOperationalErrorstill propagates and abortsSessionDB.__init__.fix(agent): handle missing trigram tokenizer without disabling FTS5
teknium1 commentedon Jun 19, 2026
Fixed in #48688 (commits 0403f41 / c10aa5d / 9ae98e0, @channkim + @liuhao1024). SessionDB.init no longer aborts on SQLite builds that have FTS5 but lack the trigram tokenizer — _is_fts5_unavailable_error now also matches 'no such tokenizer: trigram' (scoped to trigram only), and a trigram-only failure degrades just the trigram index: base messages_fts stays enabled and searchable, CJK/substring search falls back to LIKE. Verified live — no-trigram init survives, base FTS5 search preserved.
port(opentui): billing overlay, review.summary, Enter/slash fix into …
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5
fix(agent): handle missing trigram tokenizer without disabling FTS5