Session not found when selecting sessions from TUI picker #8632

Open
opened 2026-02-16 18:10:26 -05:00 by yindo · 4 comments
Owner

Originally created by @zampxdev on GitHub (Feb 5, 2026).

Originally assigned to: @rekram1-node on GitHub.

Selecting a session from the TUI session picker sometimes shows "session not found" even though the session is listed right there. Happens more often after creating a new session or with older sessions that have a lot of messages.

Two causes:

  • Binary.search uses < but the session array is sorted with localeCompare, which gives a different ordering for mixed-case strings. Session IDs have base62 random suffixes so the binary search just misses entries that are in the array.

  • If any message or part file has corrupted JSON the messages endpoint returns 500 and the whole session becomes unloadable. The catch handler labels it "session not found" which is misleading.

Originally created by @zampxdev on GitHub (Feb 5, 2026). Originally assigned to: @rekram1-node on GitHub. Selecting a session from the TUI session picker sometimes shows "session not found" even though the session is listed right there. Happens more often after creating a new session or with older sessions that have a lot of messages. Two causes: - `Binary.search` uses `<` but the session array is sorted with `localeCompare`, which gives a different ordering for mixed-case strings. Session IDs have base62 random suffixes so the binary search just misses entries that are in the array. - If any message or part file has corrupted JSON the messages endpoint returns 500 and the whole session becomes unloadable. The catch handler labels it "session not found" which is misleading.
yindo added the opentui label 2026-02-16 18:10:26 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2026):

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

  • #12002: "Session not found: ses_xxxxxx"
  • #9673: "session not found" after WSL crash
  • #8502: opencode run fails with 'Session not found' (1.1.16)
  • #7149: opencode attach --session fails with 'Session not found' since v1.1.1
  • #5510: --continue selects wrong session due to incorrect sort order in sync.tsx
  • #5431: stats command: SyntaxError: Failed to parse JSON
  • #10533: UV_UNKNOWN: unknown error - OpenCode crashes when reading corrupted JSON files
  • #2135: Session becomes unusable after UnknownError: Failed to parse

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 5, 2026): This issue might be a duplicate of existing issues. Please check: - #12002: "Session not found: ses_xxxxxx" - #9673: "session not found" after WSL crash - #8502: opencode run fails with 'Session not found' (1.1.16) - #7149: opencode attach --session fails with 'Session not found' since v1.1.1 - #5510: --continue selects wrong session due to incorrect sort order in sync.tsx - #5431: stats command: SyntaxError: Failed to parse JSON - #10533: UV_UNKNOWN: unknown error - OpenCode crashes when reading corrupted JSON files - #2135: Session becomes unusable after UnknownError: Failed to parse Feel free to ignore if none of these address your specific case.
Author
Owner

@ImGajeed76 commented on GitHub (Feb 6, 2026):

damn, you really hit that 12345 id haha

@ImGajeed76 commented on GitHub (Feb 6, 2026): damn, you really hit that 12345 id haha
Author
Owner

@saadazghour commented on GitHub (Feb 8, 2026):

Hi @zampxdev, @rekram1-node ,

I’m experiencing the same issue.

I had saved a session containing the full chat history for the codebase and application I’m working on. The session is clearly visible in the UI session picker and appears in the UI list. However, when I select it, I immediately receive a “session not found” error with the corresponding session ID.

I’ve attached screenshots below that demonstrate:

  1. The session appearing in the picker list.

    Image
  2. The exact error message displayed after selection.

    Image

Additionally:

opencode export <session_id> fails with the same “Session not found” error, even though the session is listed.

Image

Environment:

OS: Ubuntu 24.04.3 LTS x86_64

OpenCode version:

Image

Output of opencode session list showing the session.

Image
@saadazghour commented on GitHub (Feb 8, 2026): Hi @zampxdev, @rekram1-node , I’m experiencing the same issue. I had saved a session containing the full chat history for the codebase and application I’m working on. The session is clearly visible in the UI session picker and appears in the UI list. However, when I select it, I immediately receive a “session not found” error with the corresponding session ID. I’ve attached screenshots below that demonstrate: 1. The session appearing in the picker list. <img width="976" height="717" alt="Image" src="https://github.com/user-attachments/assets/81fb4afb-cec3-472f-9cd7-5543db8a2f83" /> 2. The exact error message displayed after selection. <img width="840" height="839" alt="Image" src="https://github.com/user-attachments/assets/7e0ba79c-d50a-417a-b746-c122789c615f" /> **Additionally:** opencode export <session_id> fails with the same “Session not found” error, even though the session is listed. <img width="1156" height="149" alt="Image" src="https://github.com/user-attachments/assets/81b63ee6-43e3-4dbe-8878-e71bb1bc5cdb" /> **Environment**: OS: Ubuntu 24.04.3 LTS x86_64 OpenCode version: <img width="274" height="95" alt="Image" src="https://github.com/user-attachments/assets/f90793b9-3091-4977-a6ae-6e728f4945cd" /> Output of opencode session list showing the session. <img width="1110" height="211" alt="Image" src="https://github.com/user-attachments/assets/57c7aede-926c-4781-8393-8441a2caf59a" />
Author
Owner

@raymelon commented on GitHub (Feb 11, 2026):

Having the same issue. In my case, the disk went full halting an ongoing subagent task inside the session.

Managed to send a new message to recover the session only to get QUEUED.

After restarting OpenCode, the session shows up in the TUI (session list) but is unloadable.

The TUI briefly loads the session, so I know it's not completely gone, only to shoot me back to the home screen with the gigantic red alert saying "Session not found: ses_..."

Session export does not work as well.

@raymelon commented on GitHub (Feb 11, 2026): Having the same issue. In my case, the disk went full halting an ongoing subagent task inside the session. Managed to send a new message to recover the session only to get QUEUED. After restarting OpenCode, the session shows up in the TUI (session list) but is unloadable. The TUI briefly loads the session, so I know it's not completely gone, only to shoot me back to the home screen with the gigantic red alert saying "Session not found: ses_..." Session export does not work as well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8632