Skip to content

Regression: moved Git project keeps stale worktree path in server/web on 1.18.34 #52719

Closed

Description

Description

After moving a Git repository and opening it from its new location in the server/web UI, OpenCode recognizes the new directory but keeps the deleted original path as the project worktree. New sessions briefly show thinking, then abort without a visible error because prompt initialization resolves the stale path.

This appears to be a regression of #30005, which was closed as fixed for the OpenCode 2 launch via #46713.

Environment

  • OpenCode: 1.18.34
  • OS: Linux
  • Mode: opencode serve with web UI
  • Server command: opencode serve --hostname 0.0.0.0 --port 4096
  • State database: ~/.local/share/opencode/opencode.db

Steps to reproduce

  1. Open a Git repository at /home/user/repo.
  2. Move it to /home/user/projects/repo.
  3. Open/add /home/user/projects/repo in the server/web UI.
  4. Create a new session and send a message.

Expected behavior

OpenCode updates the canonical project worktree and creates the session with /home/user/projects/repo. The prompt runs normally.

Actual behavior

OpenCode associates the new directory with the existing Git project ID, but keeps the old path in project.worktree. Sessions are then created with /home/user/repo. The UI shows thinking briefly and silently stops.

Database state before repair:

project.worktree:             /home/user/repo
project_directory.directory: /home/user/projects/repo
session.directory:           /home/user/repo

Relevant log output:

message=created ... directory=/home/user/repo
message=loop ... step=0
message=stream ... agent=title
message="prompt_async failed" ...
PlatformError: NotFound: FileSystem.realPath (/home/user/repo)
Error: ENOENT: no such file or directory

Restarting the server does not help because the stale canonical path is persisted in SQLite. Removing/re-adding the project in the UI also selects the existing Git project record.

Workaround

After backing up the database, updating both project.worktree and affected session.directory values to the new path restores operation. PRAGMA integrity_check returns ok.

Additional UX issue

The web UI does not surface the prompt_async failed filesystem error. It only shows thinking for a moment and then returns to idle, which makes this failure difficult to diagnose.

Activity

  1. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

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

    • #49817: Re-opening a moved or renamed project retains a stale project.worktree, causing FileSystem.realPath failures during prompts.
    • #50023: A moved repository leaves the old canonical worktree path in SQLite.
    • #48349: Renaming a Git project leaves project.worktree at the deleted path, and re-adding it does not refresh it.
    • #48278: Opening a moved Git project reuses its missing canonical path and stale session directories.
    • #52108: Prompts silently fail after a project folder is renamed, with prompt_async reporting FileSystem.realPath / ENOENT.
  2. neriousy commented on Oct 19, 2026

    @neriousy
    Member

    In v2, when a project is opened from a new location and its previous directory no longer exists, the project's worktree is updated to the new path, and new sessions are created in the directory you selected; this has been in place since v2.0.0. Since v2.0.27, a prompt that fails also shows its error in the session instead of silently going back to idle. To get v2: npm i -g @opencode/cli@latest or curl -fsSL https://opencode.ai/v2/install | bash (desktop: update the app). If you still see this on v2, please open a new issue with the details.

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