Skip to content

cli: V2 session import fails when the session ID already exists #48335

Open

Description

@OpeOginni

Description

  • Importing an exported V2 session into another project fails with “Session already exists” when that ID is already stored locally.
  • This also affects users sharing copies of a session between machines when the destination already has that session.
  • Expected: import an independent copy with fresh session and message IDs on collision, and report the new session ID.
  • /move can relocate an existing session, but does not create a separate copy.

Plugins

  • Not required to reproduce; covered by the core transfer tests.

OpenCode version

  • Installed: 0.0.0-beta-19425.
  • Code inspected: v2 at ae7d9f0.

Steps to reproduce

  • Export an existing session: opencode2 export <session-id> > session.json.
  • Import it into another project using the same server: opencode2 import session.json --directory /path/to/other-project.
  • Observe “Session already exists” instead of a new imported copy.

Screenshot and/or share link

  • Not attached; CLI reports “Session already exists”.

Operating System

  • macOS, Darwin 25.6.0, arm64.

Terminal

  • TERM=xterm-256color; terminal application unavailable.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the clear write-up! You're asking for opencode2 import to create an independent copy when the session ID already exists locally, with fresh session and message IDs, and to print the new session ID, instead of stopping with "Session already exists". That would let you duplicate a session into another project, or share copies between machines that already have it, which /move doesn't cover.

    Right now, rejecting an import whose ID already exists is intentional: the import endpoint returns a conflict, the CLI prints Session already exists, and the CLI tests check for that. So I've filed this as a feature request rather than a bug. Maintainers will consider it, perhaps as an opt-in flag on import, but I can't promise when or whether it will land. This can't be done as a plugin today, because plugins have no hook into session import.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions