hermes - 💡(How to fix) Fix kanban: SCHEMA_SQL creates idx_tasks_session_id before _migrate_add_optional_columns adds the column [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#28844Fetched 2026-05-20 04:01:31
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×2

On Hermes v0.14.0, hermes kanban diagnostics (and any other path that triggers connect() on an existing kanban.db) fails permanently with:

kanban: could not initialize database: no such column: session_id

This persists across hermes kanban init runs, blocking the webui kanban (which surfaces as "Kanban unavailable: Internal server error") and all CLI kanban operations.

Error Message

This persists across hermes kanban init runs, blocking the webui kanban (which surfaces as "Kanban unavailable: Internal server error") and all CLI kanban operations. → "could not initialize database: no such column: session_id" on every call. hermes kanban init doesn't help (same error). The DB is bricked from a Hermes perspective.

Root Cause

The init sequence in hermes_cli/kanban_db.py runs SCHEMA_SQL before the additive migration:

# kanban_db.py, around line 1012:
if needs_init:
    conn.executescript(SCHEMA_SQL)               # ← creates the index here
    _migrate_add_optional_columns(conn)          # ← adds session_id column here

SCHEMA_SQL itself includes (line ~868):

CREATE INDEX IF NOT EXISTS idx_tasks_session_id ON tasks(session_id);

On a fresh DB, the CREATE TABLE IF NOT EXISTS tasks (...) in SCHEMA_SQL runs first and creates the table with session_id, so the index works. On any DB created before session_id was added (older Hermes), CREATE TABLE IF NOT EXISTS is a no-op (table already exists with old schema), and then CREATE INDEX ... ON tasks(session_id) errors with "no such column" — aborting executescript before _migrate_add_optional_columns ever runs.

The migration at line ~1168 would add the column:

if "session_id" not in cols:
    _add_column_if_missing(conn, "tasks", "session_id", "session_id TEXT")
    conn.execute(
        "CREATE INDEX IF NOT EXISTS idx_tasks_session_id "
        "ON tasks(session_id)"
    )

…but it never gets the chance because executescript already failed.

Fix Action

Workaround

sqlite3 ~/.hermes/kanban.db "ALTER TABLE tasks ADD COLUMN session_id TEXT;"
hermes kanban init   # now succeeds; _migrate_add_optional_columns runs cleanly

Code Example

kanban: could not initialize database: no such column: session_id

---

# kanban_db.py, around line 1012:
if needs_init:
    conn.executescript(SCHEMA_SQL)               # ← creates the index here
    _migrate_add_optional_columns(conn)          # ← adds session_id column here

---

CREATE INDEX IF NOT EXISTS idx_tasks_session_id ON tasks(session_id);

---

if "session_id" not in cols:
    _add_column_if_missing(conn, "tasks", "session_id", "session_id TEXT")
    conn.execute(
        "CREATE INDEX IF NOT EXISTS idx_tasks_session_id "
        "ON tasks(session_id)"
    )

---

sqlite3 ~/.hermes/kanban.db "ALTER TABLE tasks ADD COLUMN session_id TEXT;"
hermes kanban init   # now succeeds; _migrate_add_optional_columns runs cleanly
RAW_BUFFERClick to expand / collapse

Summary

On Hermes v0.14.0, hermes kanban diagnostics (and any other path that triggers connect() on an existing kanban.db) fails permanently with:

kanban: could not initialize database: no such column: session_id

This persists across hermes kanban init runs, blocking the webui kanban (which surfaces as "Kanban unavailable: Internal server error") and all CLI kanban operations.

Root cause

The init sequence in hermes_cli/kanban_db.py runs SCHEMA_SQL before the additive migration:

# kanban_db.py, around line 1012:
if needs_init:
    conn.executescript(SCHEMA_SQL)               # ← creates the index here
    _migrate_add_optional_columns(conn)          # ← adds session_id column here

SCHEMA_SQL itself includes (line ~868):

CREATE INDEX IF NOT EXISTS idx_tasks_session_id ON tasks(session_id);

On a fresh DB, the CREATE TABLE IF NOT EXISTS tasks (...) in SCHEMA_SQL runs first and creates the table with session_id, so the index works. On any DB created before session_id was added (older Hermes), CREATE TABLE IF NOT EXISTS is a no-op (table already exists with old schema), and then CREATE INDEX ... ON tasks(session_id) errors with "no such column" — aborting executescript before _migrate_add_optional_columns ever runs.

The migration at line ~1168 would add the column:

if "session_id" not in cols:
    _add_column_if_missing(conn, "tasks", "session_id", "session_id TEXT")
    conn.execute(
        "CREATE INDEX IF NOT EXISTS idx_tasks_session_id "
        "ON tasks(session_id)"
    )

…but it never gets the chance because executescript already failed.

Reproduction

  1. Have a kanban.db from a Hermes version before session_id was added to the schema.
  2. Upgrade to v0.14.0.
  3. Run hermes kanban diagnostics or open the webui Kanban tab.

→ "could not initialize database: no such column: session_id" on every call. hermes kanban init doesn't help (same error). The DB is bricked from a Hermes perspective.

Workaround

sqlite3 ~/.hermes/kanban.db "ALTER TABLE tasks ADD COLUMN session_id TEXT;"
hermes kanban init   # now succeeds; _migrate_add_optional_columns runs cleanly

Suggested fix

Either:

  • (A) Move the index out of SCHEMA_SQL — keep only the CREATE TABLE IF NOT EXISTS blocks in SCHEMA_SQL, and let _migrate_add_optional_columns own all "add column + add index" pairs. This is the same shape it already follows for current_run_id, workflow_template_id, etc.
  • (B) Run _migrate_add_optional_columns before executescript(SCHEMA_SQL) — but this is brittle because the migration assumes the tables exist.

(A) is the cleaner fix and matches the existing migration pattern for sibling columns.

Environment

  • Hermes Agent v0.14.0 (2026.5.16)
  • Python 3.11.13
  • macOS Darwin 25.4.0
  • DB existed from a prior Hermes version (pre-session_id).

Happy to send a PR if helpful.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix kanban: SCHEMA_SQL creates idx_tasks_session_id before _migrate_add_optional_columns adds the column [2 comments, 3 participants]