Skip to content

bug: "duplicate session id" crash when a tmux pane exists in multiple sessions #296

@seflue

Description

@seflue

Did you check docs and existing issues?

  • I have read all the sidekick.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of sidekick.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.11.6

Operating system/version

Linux (Manjaro)

Describe the bug

tmux list-panes -a returns one entry per session-pane combination. When a pane exists in multiple sessions (via link-window, session groups, etc.), M.panes() produces duplicate skid values because skid is derived from pane_pid. The assert in session/init.lua:142 then fails:

E5108: Error executing lua: .../sidekick/cli/session/init.lua:142: duplicate session id: tmux 1382785

I have a fix and will open a PR.

Steps To Reproduce

  1. Start a supported CLI tool in any tmux session (e.g. claude)
  2. Link that window into a second session:
    tmux link-window -s <source-session>:0 -t <target-session>
  3. Open Neovim, toggle sidekick → crash

Expected Behavior

A linked pane is still one physical pane running one tool — sidekick should discover it once.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "folke/sidekick.nvim",
      opts = {
        cli = {
          mux = {
            backend = "tmux",
            enabled = true,
            create = "terminal",
          },
        },
      },
    },
  },
})
-- Before toggling sidekick, ensure a supported tool's tmux window
-- is linked into more than one session.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions