Skip to content

opencode -c hangs indefinitely in directories with no prior sessions #23437

Closed

Description

@rmk40

Description

Running opencode -c in a directory that has never had a session causes the TUI to hang. The process becomes unresponsive and must be killed with kill -9.

This worked correctly in 1.4.11 and broke sometime between then and 1.14.18.

Root cause

The --continue flag seeds the router with an initial { type: "session", sessionID: "dummy" } route to prevent a visual flash when resuming a session (introduced in 65b2a10e9 / #23037). When no sessions exist in the directory:

  1. The session route component eagerly fetches GET /session/dummy, which fails server-side validation ("dummy" doesn't start with "ses")
  2. The createEffect in App() that is responsible for replacing the dummy route with the real most-recent session never fires, because there are no sessions to match against
  3. The TUI stays stuck on the broken dummy session screen with no way to recover

Relevant code: packages/opencode/src/cli/cmd/tui/app.tsx lines 151-159 (initial route) and lines 345-366 (continue redirect effect).

Steps to reproduce

  1. cd into a directory that has never had an opencode session (e.g. mktemp -d)
  2. Run opencode -c
  3. TUI hangs indefinitely
  4. Process requires kill -9 to terminate

Plugins

None

OpenCode version

1.14.18

Operating System

macOS (Apple Silicon) -- likely affects all platforms

Terminal

Ghostty

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Apr 19, 2026
  2. github-actions commented on Apr 19, 2026

    @github-actions
    Contributor

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

  3. added a commit that references this issue on Apr 19, 2026
    da7479e
  4. rmk40 commented on Apr 28, 2026

    @rmk40
    ContributorAuthor

    No longer hangs but throws a toast error, which is good enough. Closing.

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

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions