Skip to content

fix: exit with error when --continue finds no sessions#26014

Open
Kushalk0677 wants to merge 1 commit intoanomalyco:devfrom
Kushalk0677:fix/continue-no-sessions-v3
Open

fix: exit with error when --continue finds no sessions#26014
Kushalk0677 wants to merge 1 commit intoanomalyco:devfrom
Kushalk0677:fix/continue-no-sessions-v3

Conversation

@Kushalk0677
Copy link
Copy Markdown

@Kushalk0677 Kushalk0677 commented May 6, 2026

When starting opencode on a project with no sessions, using --continue/-c errors with an invalid dummy sessionID and leaves the TUI in a broken state.

Issue for this PR

Closes #25989

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When --continue is used, the session list is now checked before the TUI starts. If no root sessions exist, it exits with a clear error message instead of entering the TUI with an invalid dummy sessionID that fails validation.

How did you verify your code works?

  • Confirmed validate-session.ts checks for root sessions when --continue is passed
  • Verified the error message prints and exits before the TUI renders

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

The following comment was made by an LLM, it may be inaccurate:

I found one potential duplicate:

Related PR:

This PR appears related because it also deals with the --continue flag and session handling. Both PRs are addressing issues with the --continue functionality, though #26011 focuses on scoping sessions to root worktree while #26014 (the current PR) specifically fixes the error exit behavior when no sessions are found.

@Kushalk0677 Kushalk0677 force-pushed the fix/continue-no-sessions-v3 branch from 9786776 to 30e570a Compare May 6, 2026 09:33
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Kushalk0677
Copy link
Copy Markdown
Author

Hi @rekram1-node, this fixes the --continue issue where the TUI crashes with an invalid sessionID when there are no prior sessions. It validates before the TUI starts and exits cleanly.

@rekram1-node
Copy link
Copy Markdown
Collaborator

Appreciate the PR but opencode already behaves as expected no?

@rekram1-node
Copy link
Copy Markdown
Collaborator

rekram1-node commented May 6, 2026

Screenshot 2026-05-06 at 10 21 59 AM

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants