zellij-org/zellij · error

You are trying to attach to the current session ("{}"). This

Error message

You are trying to attach to the current session ("{}"). This is not supported.

What it means

Error "You are trying to attach to the current session ("{}"). This is not supported." thrown in zellij-org/zellij.

Source

Thrown at src/commands.rs:805

                            }
                            ClientInfo::Resurrect(
                                session_name.clone(),
                                session_layout_cache_file_name(session_name.as_ref()),
                                force_run_commands,
                                new_session_cwd.clone(),
                            )
                        },
                        _ => attach_with_session_name(
                            session_name,
                            config_options.clone(),
                            create || should_create_detached,
                        ),
                    }
                };

                if let Ok(val) = std::env::var(envs::SESSION_NAME_ENV_KEY) {
                    if val == *client.get_session_name() {
                        panic!("You are trying to attach to the current session (\"{}\"). This is not supported.", val);
                    }
                }

                if let Some(layout_info) = layout_info {
                    client.set_layout_info(layout_info);
                }

                if let Some(new_session_cwd) = new_session_cwd {
                    client.set_cwd(new_session_cwd);
                }

                let current_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
                if let Some(initial_panes) = initial_panes_from_cli(
                    initial_command,
                    None,
                    Some(current_dir.clone()),
                    current_dir,
                    close_on_exit,

View on GitHub (pinned to e839bfffa5)

Solutions

  1. Attach from a shell outside zellij, or use a different target session name.
  2. Detach first (Ctrl o d) and then attach to the other session.

When it happens

Trigger: Occurs at src/commands.rs:792 when the operation fails: "You are trying to attach to the current session (\"{}\"). This is not supported.". Currently there is no defensive handling preventing or contextualizing this failure before it surfaces.

Common situations: Common when scripting attach commands from within an active zellij pane.


AI-assisted analysis of zellij-org/zellij@e839bfffa5 (2026-08-19). Data as JSON: /api/errors/0ab595528cbe3612. Report an issue: GitHub.