Skip to content

sessions break when their folder is renamed outside opencode #56270

Closed as duplicate

Description

@MiguelBlair2005

Summary

Renaming a project folder outside opencode orphans its sessions. They fail with LocationNotFoundError on update and there is no repair path in the product.

Environment

  • opencode version: 2.0.31 (service 2.0.30)
  • OS: Linux 7.2.10-200.fc44.x86_64 (linux x64)
  • Terminal: foot, /bin/bash
  • Install/channel: latest
  • Active plugins: none found in config

Reproduction

  1. Create a session in /home/user/Documents/myproject.
  2. Rename the folder in a file manager to /home/user/Documents/myproject-v2.
  3. Try to continue or rename the session via the API.

Expected Behavior

opencode detects the folder moved and offers to re-point the session and project, or migrates the stored paths automatically.

Actual Behavior

Session updates fail with LocationNotFoundError. Recovery requires hand-editing opencode.db rows across session_v2, project, project_directory, and worktree tables. Stale project rows can also resurrect on restart from orphaned worktree entries.

Additional Context

Consistently reproducible. Worked around with a local skill that runs session.move after every rename, but this belongs in the product.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report! I think this is a duplicate of #44256, which asks for the same thing: when a project folder is renamed or moved, detect it and re-link the sessions and project to the new path instead of leaving them orphaned. It's still open, and there is already a proposal there to implement it in v2.

    Possible duplicates and related issues, ordered from most to least likely:

    Until that lands, session.move (which you already use) and the "Session location unavailable" prompt's option to move the session are the supported ways to repoint a session.

    If you can reproduce the stale project rows coming back on restart from orphaned worktree entries, please open a separate issue with the steps.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #44256, since there's been no reply in the past day. #44256 asks for the same thing: detect when a project folder is renamed or moved and re-link its sessions and project to the new path. Please follow and add to that issue.

    Until then, session.move or the move option in the "Session location unavailable" prompt can repoint a session. If you can reproduce stale project rows coming back on restart from orphaned worktree entries, please open a new issue with the steps. If this issue is different from #44256, reply here and explain how.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions