Skip to content

Can't change path for if session location unavailible #61085

Closed as duplicate

Description

@dpvpro

Description

I constantly move my work directories for different places. And i always get this issue on screenshots. Can you make changing work directories straightforward ?

Plugins

No response

OpenCode version

2.2.4

Steps to reproduce

No response

Screenshot

Image Image Image Image

Operating System

Arch Linux Latest

Terminal

Foot

Activity

  1. changed the title [-]Cant' change path for if session location unavailible[/-] [+]Can't change path for if session location unavailible[/+] on Nov 1, 2026
  2. opencodejr commented on Nov 1, 2026

    @opencodejr
    Contributor

    Thanks for the report and screenshots. I could reproduce this on 2.2.4, and it still happens on the latest dev (97a71f0).

    What I did:

    1. Created a git project, opened it in OpenCode and sent a message.
    2. Quit OpenCode and moved the project folder somewhere else.
    3. Reopened OpenCode and opened the session from /sessions (all projects). It showed Session location unavailable – Choose another directory to continue this session.
    4. Choose directory only opens the Worktrees list for the project. That list only has the old, missing folder (in your case it was empty), and there's no way to pick or type the folder's new location.
    5. Creating a new worktree from there fails with Creating workspace failed – Worktree directory unavailable: <old folder>, because it's created from the folder that no longer exists.

    So once a project folder has moved, the TUI gives no way to point the session at its new location, even though the panel says you can choose another directory. The recording and screenshots below show this, and the script below reproduces it.

    Related issues:

    recording.mp4

    Screenshot

    Screenshot

    Reproduction script (drive.ts)
    // Repro for anomalyco/opencode#61085: after a session's project folder is moved and
    // OpenCode is restarted, "Choose directory" offers only worktrees of the missing
    // project, and creating one fails, so the session can't be pointed at the new folder.
    //
    // Run: OPENCODE_DRIVE_DB=restart.sqlite OPENCODE_DRIVE_MEDIA_DIR=/workspace/media \
    //        opencode-drive start --name issue-61085 --script ./drive.ts   [--dev /path/to/opencode]
    import { execSync } from "node:child_process"
    import { mkdirSync, renameSync, rmSync, writeFileSync } from "node:fs"
    import { defineScript, Effect, Llm } from "opencode-drive"
    
    const base = "/tmp/opencode/issue-61085"
    const original = `${base}/my-project`
    const moved = `${base}/my-project-moved`
    
    export default defineScript({
      launch: "manual",
      project: { git: true },
      run: ({ server, tuis, llm }) =>
        Effect.gen(function* () {
          yield* Effect.sync(() => {
            rmSync(base, { recursive: true, force: true })
            mkdirSync(original, { recursive: true })
            writeFileSync(`${original}/README.md`, "hello\n")
            execSync("git init -q && git add . && git -c user.email=a@b -c user.name=a commit -qm init", { cwd: original })
          })
          yield* server.launch()
          const first = yield* tuis.launch("first", { recording: true, keypressOverlay: true })
          const ui = first.ui
          // 1. Switch to the project and start a session there.
          yield* Effect.sleep(2000)
          yield* ui.type(`/cd ${original}`)
          yield* Effect.sleep(800)
          yield* ui.enter() // accept the autocompletion
          yield* Effect.sleep(500)
          yield* ui.enter() // run /cd
          yield* ui.waitFor("my-project", { timeout: 10000 })
          yield* Effect.sleep(1000)
          yield* llm.queue(Llm.text("Hi from the original folder."))
          yield* ui.submit("hello")
          yield* ui.waitFor("Hi from the original folder.")
          yield* ui.screenshot("01-session")
          yield* Effect.sleep(1000)
          yield* first.close()
    
          // 2. Quit OpenCode (TUI and server) and move the project folder.
          yield* server.kill()
          yield* Effect.sync(() => renameSync(original, moved))
          // The resumed turn after restart may issue one more model request.
          yield* llm.queue(Llm.text("ok"))
          yield* server.launch()
    
          // 3. Reopen OpenCode and open the session from /sessions (all projects).
          const second = yield* tuis.launch("second", { recording: true, keypressOverlay: true })
          const ui2 = second.ui
          yield* Effect.sleep(2500)
          yield* ui2.type("/sessions")
          yield* Effect.sleep(800)
          yield* ui2.enter()
          yield* Effect.sleep(1500)
          yield* ui2.press("a", { ctrl: true }) // all projects
          yield* ui2.waitFor("Hi from the original folder.", { timeout: 10000 })
          yield* Effect.sleep(800)
          yield* ui2.enter()
          yield* Effect.sleep(6000)
          yield* ui2.waitFor("Session location unavailable", { timeout: 20000 }).pipe(
            Effect.tapError(() => ui2.screenshot("03-debug")),
          )
          yield* Effect.sleep(800)
          yield* ui2.screenshot("03-location-unavailable")
    
          // 4. "Choose directory" -> only a Worktrees list; no way to pick the moved folder.
          yield* ui2.enter()
          yield* ui2.waitFor("Worktrees", { timeout: 10000 })
          yield* Effect.sleep(2000)
          yield* ui2.screenshot("04-worktrees")
    
          // 5. Creating a new worktree fails because the source folder is gone.
          yield* ui2.press("a", { ctrl: true })
          yield* ui2.waitFor("Name worktree", { timeout: 10000 })
          yield* ui2.type("fresh")
          yield* ui2.enter()
          yield* ui2.waitFor("Creating workspace failed", { timeout: 15000 })
          yield* Effect.sleep(800)
          yield* ui2.screenshot("05-create-failed")
          yield* Effect.sleep(1500)
        }),
    })

    Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH.

  3. jimmyallinai commented on Nov 1, 2026

    @jimmyallinai
    Contributor

    I'll take this one.

    Plan: reproduce the TUI dead-end (a moved project folder leaves the session at "Session location unavailable", and "Choose directory" only lists the old worktree, so there is no way to point the session at its new location). Then I'll add a "Type a directory" recovery option to that panel which moves the session to the typed path through the existing session.move endpoint — the web panel already offers a directory picker for the same situation — plus a TUI regression test for typed-path recovery. I'll run the prompt-move TUI tests and the tui typecheck before opening the PR.

  4. neriousy commented on Nov 23, 2026

    @neriousy
    Member

    Closing as a duplicate of #55035: no way to repoint a session whose location is unavailable. Please follow that issue for updates and add any extra details there.

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