{"record":{"id":"0ab595528cbe3612","repo":"zellij-org/zellij","slug":"you-are-trying-to-attach-to-the-current-session","errorCode":null,"errorMessage":"You are trying to attach to the current session (\"{}\"). This is not supported.","messagePattern":"You are trying to attach to the current session \\(\"(.+?)\"\\)\\. This is not supported\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commands.rs","lineNumber":805,"sourceCode":"                            }\n                            ClientInfo::Resurrect(\n                                session_name.clone(),\n                                session_layout_cache_file_name(session_name.as_ref()),\n                                force_run_commands,\n                                new_session_cwd.clone(),\n                            )\n                        },\n                        _ => attach_with_session_name(\n                            session_name,\n                            config_options.clone(),\n                            create || should_create_detached,\n                        ),\n                    }\n                };\n\n                if let Ok(val) = std::env::var(envs::SESSION_NAME_ENV_KEY) {\n                    if val == *client.get_session_name() {\n                        panic!(\"You are trying to attach to the current session (\\\"{}\\\"). This is not supported.\", val);\n                    }\n                }\n\n                if let Some(layout_info) = layout_info {\n                    client.set_layout_info(layout_info);\n                }\n\n                if let Some(new_session_cwd) = new_session_cwd {\n                    client.set_cwd(new_session_cwd);\n                }\n\n                let current_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from(\".\"));\n                if let Some(initial_panes) = initial_panes_from_cli(\n                    initial_command,\n                    None,\n                    Some(current_dir.clone()),\n                    current_dir,\n                    close_on_exit,","sourceCodeStart":787,"sourceCodeEnd":823,"githubUrl":"https://github.com/zellij-org/zellij/blob/e839bfffa586992364309a685b2c71f3b23c247e/src/commands.rs#L787-L823","documentation":"Error \"You are trying to attach to the current session (\"{}\"). This is not supported.\" thrown in zellij-org/zellij.","triggerScenarios":"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.","commonSituations":"Common when scripting attach commands from within an active zellij pane.","solutions":["Attach from a shell outside zellij, or use a different target session name.","Detach first (Ctrl o d) and then attach to the other session."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e839bfffa586992364309a685b2c71f3b23c247e","analyzedAt":"2026-08-19T07:42:58.758Z","contentChangedAt":"2026-08-19T07:42:58.758Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}