GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [BUG] session_list returns empty despite sessions existing in database · Issue #15108 · anomalyco/opencode

[BUG] session_list returns empty despite sessions existing in database #15108

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[BUG] session_list returns empty despite sessions existing in database#15108
Copy link
Assignees
jlongster

Description

@ludwiklisowski80
ludwiklisowski80
opened on Feb 25, 2026
Issue body actions

Bug Report: session_list Returns Empty Despite Sessions Existing in Database

Date: 2026-02-25
User: gromada project (/home/lu/Documents/gromada)
OpenCode Version: 1.2.13

Summary

The session_list tool returns an empty list despite sessions existing in the SQLite database. Sessions ARE being saved correctly to ~/.local/share/opencode/opencode.db, but the list function fails to return them.

Reproduction

  1. User works on project /home/lu/Documents/gromada for several hours
  2. Multiple sessions are created and saved (verified in database)
  3. User runs session_list() - returns empty list []
  4. User runs session_search() - finds sessions successfully
  5. User runs direct SQL query - sessions exist in database

Evidence

Database Query (works correctly)

SELECT id, slug, title, time_created 
FROM session 
WHERE project_id = '0414ba0fb05af3df687d6e70501ee7febfcc7f8d'
ORDER BY time_created DESC;

Returns: 100+ sessions including:

  • ses_36a097a42ffepWYz5H1l6jJKOY (current session, 18:01)
  • ses_36a341e68ffe2PEYbaF2Yqe7sW (17:14)
  • ses_36ae4dc54ffeb42G7NrhUIAx4k (14:01)
  • ses_36b7be405ffebyxrRCtLTlh8uZ (11:16)

session_list (returns empty)

session_list({})
// Returns: []

session_search (works correctly)

session_search({query: "gromada"})
// Returns: Found matches with session data

Analysis

The sessions ARE being saved correctly to the database. The bug appears to be in the session_list function implementation, not in the session saving mechanism.

Possible causes:

  1. Query filtering issue - session_list may be applying incorrect filters (e.g., filtering by wrong project_id, date range, or archived status)
  2. Database connection issue - session_list may not be connecting to the correct database or using correct schema
  3. API response handling - the list may be returned but filtered out before being returned to the user

Impact

  • Users cannot see their session history through the list interface
  • Users must use session_search to find sessions (workaround works)
  • Users must know exact session IDs to resume sessions

Recommendation

Investigate the session_list function implementation:

  1. Check the SQL query being generated
  2. Verify filtering parameters (project_id, date range)
  3. Check for any error handling that might suppress results
  4. Compare with session_search implementation to identify differences

Workaround

Use session_search() with a query term to find sessions, or query the database directly:

sqlite3 ~/.local/share/opencode/opencode.db "SELECT id, title, time_created FROM session WHERE directory LIKE '%gromada%' ORDER BY time_created DESC LIMIT 20;"
Reacted by Luka Boulpaep and Alex Povel

Activity

  1. github-actions
    assigned
    thdxr
    on Feb 25, 2026
  2. github-actions
    added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 25, 2026
  3. github-actions commented on Feb 25, 2026

    @github-actions
    github-actionsBot
    on Feb 25, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of an existing issue. Please check:

    • session-list shows empty when --project-path equals current directory #15023: session-list shows empty when --project-path equals current directory — same symptom of session_list returning an empty list despite sessions existing in the database. The underlying cause may be the same.
  4. lukaboulpaep commented on Feb 25, 2026

    @lukaboulpaep
    lukaboulpaep
    on Feb 25, 2026
    More actions

    Having the same problem

  5. huayu0721 commented on Mar 7, 2026

    @huayu0721
    huayu0721
    on Mar 7, 2026
    More actions

    A possible temporary solution :entry ~/.local/share/opencode/storage and run opencode db migrate ,then my sessions came back

  6. thdxr
    assigned
    jlongster
    and unassigned
    thdxr
    on Apr 26, 2026
  7. thdxr
    removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  8. codeg-old commented on May 8, 2026

    @codeg-old
    codeg-old
    on May 8, 2026
    More actions

    Additional reproduction on macOS with OpenCode 1.14.41.

    Observed behavior:

    • opencode session list -n 5 --format json returns recent sessions normally for the active project.
    • The MCP/session tool session_list({ project_path: <active project path> }) returns No sessions found.
    • For a session ID returned by the CLI:
      • session_info(session_id) succeeds and reports message count/date range/transcript metadata.
      • session_read(session_id) fails with Session not found.
    • session_search(...) also returns no matches for terms present in the active session context.
    • The legacy session storage directory (~/.local/share/opencode/storage/session/) exists but contains 0 entries.
    • opencode db path points to the SQLite DB under the normal OpenCode data directory.

    This looks like the session tools and the CLI/runtime are not reading the same source of truth. The CLI sees sessions in the current SQLite-backed store, while session_list/session_read appear to miss them, possibly by consulting legacy file storage or applying a different project/session filter.

    I did not modify the database while testing; the checks above used the OpenCode CLI plus the session MCP/tool surface.

    Authorship disclosure: this reproduction note was prepared with AI assistance.

  9. codeg-old commented on May 9, 2026

    @codeg-old
    codeg-old
    on May 9, 2026
    More actions

    Related PR for the TUI session picker side: #26432.

    That PR fixes the root-session dilution in the TUI dialog by querying root sessions directly for /sessions while leaving the shared session bootstrap unchanged for child-session navigation.

    It does not claim to fix the separate MCP/session-tool source-of-truth mismatch reported here (session_list/session_read behavior). I am calling that out so the two layers do not get conflated.

    Authorship disclosure: prepared with AI assistance.

  10. github-actions commented on Jul 9, 2026

    @github-actions
    github-actionsBot
    on Jul 9, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  11. github-actions
    closed this as not plannedon Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jlongster
    jlongster

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.