Skip to content

Old sessions cannot be loaded #16878

Closed as not planned
Closed as not planned

Description

@Laurenz-Ruzicka

Description

The session list is empty

Please let me know what other information I can provide to solve this issue

Plugins

None

OpenCode version

1.2.24

Steps to reproduce

Run something
Try to load an old session

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

bash

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 10, 2026
  2. github-actions commented on Mar 10, 2026

    @github-actions
    Contributor

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

    In particular, #16579 covers a migration issue introduced around v1.2.21 that causes old sessions to become inaccessible — since you're on v1.2.24, this may be the same root cause. That issue includes diagnostic steps and a workaround worth trying.

    It would also help to fill in the Operating System and Terminal fields, and to provide more specific reproduction steps (e.g. whether this happens in a git repo, after an upgrade, on first launch, etc.) so maintainers can triage more effectively.

  3. Laurenz-Ruzicka commented on Mar 10, 2026

    @Laurenz-Ruzicka
    Author

    I added the os and terminal, and the issue persists even in 1.2.24. A session started here is not stored/accessible

  4. ipatalas commented on Mar 10, 2026

    @ipatalas

    I am experiencing the same but only in web interface. I cannot get back to old sessions, list is empty. Surprisingly when I click Load More I can see sessions being loaded in the browser dev tools on the network tab but they are not shown. No JS errors there.
    However in TUI all sessions are visible.

  5. HRronaldo commented on Mar 10, 2026

    @HRronaldo

    Windows 11 also exhibits the same issue: in versions 1.2.20 to 1.2.24, all old sessions on the opencode web platform become inaccessible.

    #16562

  6. aiulms commented on Mar 11, 2026

    @aiulms

    I am experiencing the same issue on Windows 11 with OpenCode 1.2.24.

    Environment:

    • OS: Windows 11
    • OpenCode version: 1.2.24 (Desktop app)
    • Interface: Web UI

    Symptoms:

    • Session list is empty in Web UI
    • Cannot see any historical sessions after upgrading
    • New sessions created also cannot be found/switched back to
    • Database shows 61 sessions exist but UI displays 0

    Database verification (confirmed sessions exist):

    Database: C:\Users\izeiw\.local\share\opencode\opencode.db
    Total sessions: 61
    project_id: global
    workspace: exists (1 workspace)
    

    What I've tried:

    1. Updated workspace_id for all sessions (was NULL after migration)
    2. Unified directory paths to "/"
    3. Created missing session storage files

    None of these fixes resolved the UI display issue. The sessions exist in the database but the Web UI still shows an empty list.

    Please let me know if you need any additional diagnostic information.

  7. aiulms commented on Mar 11, 2026

    @aiulms

    Correction: I am using the Desktop App (not Web UI) on Windows 11.

    To clarify:

    • OpenCode Desktop App (installed via winget)
    • Version: 1.2.24
    • Session list shows empty in the Desktop App UI

    Sorry for the confusion in my previous comment.

  8. n2k3 commented on Mar 11, 2026

    @n2k3

    Just experienced the same, my session list is empty after restarting OC (TUI) via the opencode command in CLI.
    I can still access previous prompts via the up arrow.

    On MacOS
    Version 1.2.24

  9. hsuanguo commented on Mar 11, 2026

    @hsuanguo

    same issue here

  10. SunYanbox commented on Mar 11, 2026

    @SunYanbox

    I also encountered the same issue. The GUI only has the last conversation record, and all others are lost; the TUI didn't load any conversation records in the same workspace.

  11. aiulms commented on Mar 12, 2026

    @aiulms

    Correction: Environment 2 was Windows 11 (not 10), with existing system but fresh OpenCode install.

  12. aiulms commented on Mar 12, 2026

    @aiulms

    📝 补充说明(来自另一台电脑的用户测试)

    测试环境:

    • 另一台全新的电脑
    • 新安装的 OpenCode
    • 系统平台:Windows 11(待确认)
    • OpenCode 版本:待确认

    遇到的问题:

    ❌ 无法启用新会话

    1. 看不到历史会话 - 新安装的 OpenCode 无法看到之前的会话历史
    2. 新会话丢失上下文 - 新建会话后,上一轮对话内容消失
    3. 卡在单会话局面 - 只能在一个会话中继续对话,无法开启新的独立会话

    影响:

    • 无法进行多线并行的任务
    • 无法测试不同场景的对话
    • 每次新开会话都要重新说明背景

    期望行为:

    • ✅ 能看到历史会话列表
    • ✅ 新会话保留独立的对话历史
    • ✅ 可以在多个会话间切换

    这是否与会话存储机制有关? 求官方解答!🙏

  13. iamironz commented on Apr 23, 2026

    @iamironz

    Same thing

  14. assigned and unassigned on Apr 26, 2026
  15. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  16. codyanthony850 commented on May 6, 2026

    @codyanthony850

    Hit by this on v1.14.39 (macOS, TUI). Different root cause from the child-session dilution in #16270 and the directory-scoping issue @CasualDeveloper found in #13877.

    Root cause: The path column was added to the session table at some point, but existing rows were never backfilled. Old sessions have path = NULL, sessions created after ~v1.14.29 have path = ''. The list query matches on path and NULL != '' in SQL, so pre-v1.14.29 sessions are invisible.
    -- my database:
    SELECT CASE WHEN path IS NULL THEN 'NULL' ELSE 'empty string' END, COUNT(*), MIN(version), MAX(version)
    FROM session GROUP BY (path IS NULL);
    -- NULL | 520 | 1.4.9 | 1.14.19
    -- empty string | 85 | 1.14.29 | 1.14.39

    Workaround (fixed it immediately for me):
    cp ~/.local/share/opencode/opencode.db ~/.local/share/opencode/opencode.db.bak
    sqlite3 ~/.local/share/opencode/opencode.db "UPDATE session SET path = '' WHERE path IS NULL;"

    Proper fix would be a migration that backfills path = '' where NULL on upgrade.

  17. CasualDeveloper commented on May 10, 2026

    @CasualDeveloper
    Contributor

    @codyanthony850 Good catch. I hit this locally too, and backfilling path fixed the inconsistent session picker behavior for me.

    One nuance: UPDATE session SET path = '' WHERE path IS NULL is only safe when session.directory is the project worktree root. For sessions created in subdirs or under the global project, '' flattens them to the root and changes picker behavior.

    The safer migration is to backfill path from the project-relative directory:

    path = relative(project.worktree, session.directory)
    

    Examples:

    • project root session -> path = ''
    • repo subdir session -> path = 'packages/opencode'
    • global session under a home subdirectory, with worktree /, should keep that relative subpath rather than become ''

    After backfilling all rows this way, old and new sessions behaved consistently for me.

  18. github-actions commented on Jul 10, 2026

    @github-actions
    Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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