fix(gateway): /title command fails when session doesn't exist in SQLite yet#2379
Merged
teknium1 merged 1 commit intoNousResearch:mainfrom Mar 21, 2026
Merged
Conversation
…te yet The /title command would fail with 'Session not found in database.' when used as the first command in a new session. This happened because: 1. Gateway creates session in session_store (in-memory) 2. But SQLite _session_db only gets sessions when agent flushes messages 3. set_session_title() does UPDATE which fails if row doesn't exist Now we check if session exists in SQLite and create it if needed before attempting to set the title. Fixes: Session not found in database. error on /title in new chats
outsourc-e
pushed a commit
to outsourc-e/hermes-agent
that referenced
this pull request
Mar 26, 2026
…te yet (NousResearch#2379) The /title command would fail with 'Session not found in database.' when used as the first command in a new session. This happened because: 1. Gateway creates session in session_store (in-memory) 2. But SQLite _session_db only gets sessions when agent flushes messages 3. set_session_title() does UPDATE which fails if row doesn't exist Now we check if session exists in SQLite and create it if needed before attempting to set the title. Fixes: Session not found in database. error on /title in new chats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Description
When using /title as the first command in a new Telegram (or other messaging platform) chat, it fails with:
Root Cause
The gateway maintains two session stores:
When /title is used before any actual conversation, the session exists in memory but not in SQLite. The
set_session_title()method does an UPDATE query which returns 0 rows affected, causing the error.Fix
Check if the session exists in SQLite before attempting to set the title. If it doesn't exist, create it first using
create_session().Testing