Skip to content

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

Closed

Description

@K4leri

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

Activity

  1. github-actions commented on Jan 27, 2026

    @github-actions
    Contributor

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

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

  2. salfum commented on Jan 28, 2026

    @salfum

    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.

  3. vlnifos commented on Feb 2, 2026

    @vlnifos

    same issue happened for me

  4. github-actions commented on Apr 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 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

bugSomething isn't workingwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions