After BSOD there is no sessions available to read but they are still exists on disk #7779

Open
opened 2026-02-16 18:08:12 -05:00 by yindo · 3 comments
Owner

Originally created by @K4leri on GitHub (Jan 27, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

there were open 8-10 windows of opencode. then i get BSOD after smth what i did.
after restarting pc there is no sessions available to load but they exists on disk.

The file ses_405cda89affeNw04UbeaVEBJX2.json in ~/.local/share/opencode/storage/session/<project_id>/ was corrupted during the BSOD — it contains 413 bytes of 0x00 (null bytes) instead of valid JSON. The session had no associated messages (the corresponding message directory doesn't exist).
When OpenCode tries to load the session list, it attempts to parse this file, fails with a JSON decode error, and apparently stops processing — resulting in zero sessions being shown to the user, even though 18 other valid session files exist.
Expected behavior:

  1. OpenCode should gracefully handle corrupted/unparseable session files — skip them and continue loading the rest
  2. Ideally, show a warning that N session(s) could not be loaded due to corruption
  3. Consider implementing atomic writes (write to temp file + rename) to prevent corruption during unexpected shutdowns

Workaround:
Delete the corrupted file manually:
rm ~/.local/share/opencode/storage/session/<project_id>/ses_405cda89affeNw04UbeaVEBJX2.json
You can identify corrupted files with:

import json, os
base = os.path.expanduser("~/.local/share/opencode/storage/session")
for project in os.listdir(base):
    pdir = os.path.join(base, project)
    if not os.path.isdir(pdir): continue
    for f in os.listdir(pdir):
        fp = os.path.join(pdir, f)
        try:
            with open(fp, 'r') as fh: json.load(fh)
        except: print(f"BROKEN: {project}/{f}")

Suggested fix:
In the session loading code, wrap the JSON parse in a try/catch and skip corrupted files instead of failing the entire operation. Additionally, use atomic file writes (write to .tmp then os.Rename) to prevent partial writes during crashes.

Plugins

No response

OpenCode version

v1.1.36

Steps to reproduce

  1. BSOD
  2. open opencode
  3. no sessions

idn if its have the a 100% representive way

Screenshot and/or share link

Image Image

Operating System

windows 10

Terminal

windows terminal

Originally created by @K4leri on GitHub (Jan 27, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description there were open 8-10 windows of opencode. then i get BSOD after smth what i did. after restarting pc there is no sessions available to load but they exists on disk. The file ses_405cda89affeNw04UbeaVEBJX2.json in ~/.local/share/opencode/storage/session/<project_id>/ was corrupted during the BSOD — it contains 413 bytes of 0x00 (null bytes) instead of valid JSON. The session had no associated messages (the corresponding message directory doesn't exist). When OpenCode tries to load the session list, it attempts to parse this file, fails with a JSON decode error, and apparently stops processing — resulting in zero sessions being shown to the user, even though 18 other valid session files exist. Expected behavior: 1. OpenCode should gracefully handle corrupted/unparseable session files — skip them and continue loading the rest 2. Ideally, show a warning that N session(s) could not be loaded due to corruption 3. Consider implementing atomic writes (write to temp file + rename) to prevent corruption during unexpected shutdowns Workaround: Delete the corrupted file manually: `rm ~/.local/share/opencode/storage/session/<project_id>/ses_405cda89affeNw04UbeaVEBJX2.json` You can identify corrupted files with: ```py import json, os base = os.path.expanduser("~/.local/share/opencode/storage/session") for project in os.listdir(base): pdir = os.path.join(base, project) if not os.path.isdir(pdir): continue for f in os.listdir(pdir): fp = os.path.join(pdir, f) try: with open(fp, 'r') as fh: json.load(fh) except: print(f"BROKEN: {project}/{f}") ``` Suggested fix: In the session loading code, wrap the JSON parse in a try/catch and skip corrupted files instead of failing the entire operation. Additionally, use atomic file writes (write to .tmp then os.Rename) to prevent partial writes during crashes. ### Plugins _No response_ ### OpenCode version v1.1.36 ### Steps to reproduce 1. BSOD 2. open opencode 3. no sessions idn if its have the a 100% representive way ### Screenshot and/or share link <img width="1474" height="911" alt="Image" src="https://github.com/user-attachments/assets/c69e6d4a-d828-4bc8-bc4a-43a06eefdec2" /> <img width="847" height="214" alt="Image" src="https://github.com/user-attachments/assets/5752cc97-2b5d-4b21-a64d-777bbcb39677" /> ### Operating System windows 10 ### Terminal windows terminal
yindo added the windowsbug labels 2026-02-16 18:08:12 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 27, 2026):

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

  • #6625: TUI sessions disappear on reload on Windows even though they are saved in .local - exact same Windows session disappearance issue
  • #7186: Sessions not displayed in /session for specific project path despite being written to storage - sessions exist on disk but don't appear in the UI
  • #7607: If disk space runs out your active session becomes corrupted - explains how sessions can become inaccessible after system interruptions
  • #3026: /sessions shows empty despite sessions existing in storage - sessions persist on disk but fail to load in UI

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

@github-actions[bot] commented on GitHub (Jan 27, 2026): This issue might be a duplicate of existing issues. Please check: - #6625: TUI sessions disappear on reload on Windows even though they are saved in .local - exact same Windows session disappearance issue - #7186: Sessions not displayed in /session for specific project path despite being written to storage - sessions exist on disk but don't appear in the UI - #7607: If disk space runs out your active session becomes corrupted - explains how sessions can become inaccessible after system interruptions - #3026: /sessions shows empty despite sessions existing in storage - sessions persist on disk but fail to load in UI Feel free to ignore if none of these address your specific case.
Author
Owner

@salfum commented on GitHub (Jan 28, 2026):

Experienced the same issue with empty sessions list after reloading opencode. Fixed it by deleting empty session's directory in this path .local/share/opencode/storage/session.

@salfum commented on GitHub (Jan 28, 2026): Experienced the same issue with empty sessions list after reloading opencode. Fixed it by deleting empty session's directory in this path `.local/share/opencode/storage/session`.
Author
Owner

@vlnifos commented on GitHub (Feb 2, 2026):

same issue happened for me

@vlnifos commented on GitHub (Feb 2, 2026): same issue happened for me
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7779