Skip to content

bug: stale snapshot index.lock breaks Modified Files and undo for one workspace #22275

Closed as not planned

Description

@FreeBardL

Description

In one specific workspace, OpenCode stopped showing Modified Files, and revert undo messages and file changes no longer worked correctly. Other workspaces on the same machine were fine.

I traced it to a stale lock file in OpenCode's local snapshot cache for that workspace. The OpenCode logs repeatedly showed snapshot failures like:

fatal: Unable to create .../snapshot/<project-id>/<hash>/index.lock: File exists.

After removing the stale index.lock and then backing up/removing the workspace's snapshot cache under ~/.local/share/opencode/snapshot/<project-id>, the problem immediately went away.

This makes the workspace get stuck in a bad state where snapshot tracking is broken persistently, which seems to break both Modified Files and undo/revert behavior.

Plugins

None that seem relevant.

OpenCode version

1.3.7

Steps to reproduce

  1. Use OpenCode in a git workspace until its local snapshot repo ends up with a stale index.lock under ~/.local/share/opencode/snapshot/<project-id>/.../index.lock.
  2. Open that workspace again.
  3. Make a file change through OpenCode.
  4. Observe that Modified Files may not show up for that workspace, and revert undo messages and file changes does not correctly revert file changes.
  5. Check OpenCode logs and see repeated snapshot failures with index.lock: File exists.
  6. Remove the stale lock / reset the workspace snapshot cache, then restart OpenCode.
  7. Observe that the workspace starts working normally again.

Screenshot and/or share link

I did not capture a share link, but I confirmed the root cause locally from the OpenCode log and snapshot cache.

Operating System

macOS (Apple Silicon)

Terminal

VSCode integrated terminal

Activity

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

    @github-actions
    Contributor

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

    • Snapshot contention leaves lock artifacts and disk churn #15019: "Snapshot contention leaves lock artifacts and disk churn" — this closed issue tracked the same index.lock artifact problem under snapshot contention and was assigned for fixes. It's possible this is a regression or a case not fully covered by that fix.
  3. FreeBardL commented on Apr 13, 2026

    @FreeBardL
    Author

    Additional context: this looked workspace-specific, not global.

    • Other workspaces on the same machine were working normally.
    • Only this workspace lost Modified Files and had broken undo/revert.
    • The issue was resolved immediately after deleting the stale index.lock and resetting that workspace's snapshot cache under ~/.local/share/opencode/snapshot/<project-id>.

    So this seems consistent with #15019 as a regression or an uncovered recovery path when a workspace snapshot repo gets stuck.

  4. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 3, 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