Skip to content

Renaming a project folder breaks new sessions (stale worktree) #53476

Closed as not planned

Description

@BoYanZh

Description

Renamed a git-backed project folder on disk. Opening OpenCode in the new folder still sends the old path as x-opencode-directory, new sessions resolve to the global project, and any prompt fails with FileSystem.realPath ENOENT for the old path. The project row keeps the dead worktree because Project.fromDirectory never updates it for non-global projects.

OpenCode version

1.18.33-win-deploy

Steps to reproduce

  1. Open OpenCode in a git-backed project folder.
  2. Rename the folder on disk.
  3. Open OpenCode in the renamed folder and create a session.
  4. Send a prompt. prompt_async fails with ENOENT pointing at the old folder. The project worktree in the database still shows the old path.

Operating System

Windows 11

Activity

  1. github-actions commented on Oct 6, 2026

    @github-actions
    Contributor

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

    • #38578: Desktop restores a moved workspace and prompt submissions fail with the same FileSystem.realPath ENOENT error.
    • #40336: Desktop sessions fail after a project folder is moved or renamed.
    • #35491: Sending a command fails with FileSystem.realPath ENOENT when the stored session directory points to a moved or deleted project.
    • #27822: Proposes relinking sessions after a git-backed project folder is renamed or moved.
  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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