Skip to content

[FEATURE]: Fail gracefully when using --continue flag on a project with zero sessions #25989

Closed

Description

@superDuperCyberTechno

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When starting opencode on a project with no sessions available, the client returns the following error...

{
  "data": {
    "sessionID": "dummy"
  },
  "error": [
    {
      "origin": "string",
      "code": "invalid_format",
      "format": "starts_with",
      "prefix": "ses",
      "path": [
        "sessionID"
      ],
      "message": "Invalid string: must start with \"ses\""
    }
  ],
  "success": false

I'd like to propose that missing sessions are ignored when using the --continue/-c option.

Activity

  1. github-actions commented on May 6, 2026

    @github-actions
    Contributor

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

    Please review #23437 and let us know if your issue is still present or if it was addressed differently.

  2. kagura-chen commented on May 6, 2026

    @kagura-chen
    Contributor

    I'd like to work on this. The root cause is in the TUI's app.tsx: when --continue is used, the initial route is set to sessionID: "dummy", and the effect that resolves the actual session simply does nothing when no sessions exist — leaving the invalid "dummy" route active.

    The fix: in the createEffect that handles --continue, when no session is found and sync has loaded, navigate to the home route instead. This matches run.ts behavior which already gracefully falls back to creating a new session.

  3. Kushalk0677 commented on May 6, 2026

    @Kushalk0677

    Solved it -

    #26000

  4. rekram1-node commented on May 6, 2026

    @rekram1-node
    Collaborator
    Screenshot 2026-05-06 at 10 21 59 AM

    This has been fixed, it beahves as expected

  5. superDuperCyberTechno commented on May 7, 2026

    @superDuperCyberTechno
    Author
    Screenshot 2026-05-06 at 10 21 59 AM

    This has been fixed, it beahves as expected

    This is not the behavior I see...

    Image
  6. superDuperCyberTechno commented on May 12, 2026

    @superDuperCyberTechno
    Author

    @rekram1-node

    v1.14.48 introduces a regression with the following being dumped to the home screen...

    Error: Expected a string starting with "ses", got "dummy"
        at <anonymous> (/$bunfs/root/chunk-w8ygwpb0.js:25:10123)
        at <anonymous> (/$bunfs/root/chunk-w8ygwpb0.js:35:4256)
        at <anonymous> (/$bunfs/root/chunk-pyddsvgn.js:2:117604)
        at ~effect/Effect/successCont (/$bunfs/root/chunk-w8ygwpb0.js:25:7736)
        at runLoop (/$bunfs/root/chunk-w8ygwpb0.js:25:2045)
        at evaluate (/$bunfs/root/chunk-w8ygwpb0.js:25:1435)
        at <anonymous> (/$bunfs/root/chunk-w8ygwpb0.js:25:24200)
        at <anonymous> (/$bunfs/root/chunk-fbmkme8a.js:4:19972)
        at new Promise (native:1:11)
        at <anonymous> (/$bunfs/root/chunk-fbmkme8a.js:4:19842)
        at fetch (/$bunfs/root/src/cli/cmd/tui/worker.js:2:3220)
        at <anonymous> (/$bunfs/root/chunk-wy5bppnp.js:2:
    

    For anyone reading, this erroneous behaviour can be bypassed with the following bash function...

    run_opencode() {
      session_exists=$(opencode session list --format json -n 1)
      if [[ -n "${session_exists}" ]]; then
        opencode --continue
      else
        opencode
      fi
    }
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