{"record":{"id":"f95db5ebd7925fac","repo":"Hmbown/CodeWhale","slug":"running-tmux-lane-has-incomplete-pinned-sessi","errorCode":null,"errorMessage":"running tmux lane `{}` has incomplete pinned session metadata; refusing unsafe stop","messagePattern":"running tmux lane `(.+?)` has incomplete pinned session metadata; refusing unsafe stop","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/lane/src/runtime.rs","lineNumber":852,"sourceCode":"        &self,\n        registry: &LaneRegistry,\n        record: &mut LaneRecord,\n        fence: Option<u64>,\n    ) -> Result<TerminalTransition> {\n        let dry_run = std::env::var_os(\"CODEWHALE_LANE_TMUX_DRY_RUN\").is_some();\n        let transition = registry.mark_terminal_if_active_fenced(\n            record,\n            LaneStatus::Stopped,\n            fence,\n            |current| {\n                if !dry_run {\n                    match (\n                        current.tmux_socket.as_deref(),\n                        current.tmux_session.as_deref(),\n                    ) {\n                        (Some(socket), Some(session)) => stop_tmux_session(socket, session)?,\n                        _ if current.status == LaneStatus::Running => {\n                            bail!(\n                                \"running tmux lane `{}` has incomplete pinned session metadata; refusing unsafe stop\",\n                                current.id\n                            );\n                        }\n                        _ => {}\n                    }\n                }\n                Ok(())\n            },\n        )?;\n        if transition.transitioned() {\n            append_log_event(\n                &record.log_path,\n                serde_json::json!({\n                    \"type\": \"lane_stopped\",\n                    \"lane_id\": record.id,\n                    \"session\": record.tmux_session,\n                }),","sourceCodeStart":834,"sourceCodeEnd":870,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/lane/src/runtime.rs#L834-L870","documentation":"TmuxRuntime::stop runs inside the fenced Stopped transition: for a Running lane it must kill the pinned tmux session, so it requires both tmux_socket and tmux_session on the record. A Running record missing either field bails here — the runtime refuses to guess which session to kill, trading a hard error for the risk of terminating an unrelated session.","triggerScenarios":"Stopping a Running tmux lane whose record lacks tmux_socket/tmux_session: records written by an older version before metadata pinning, hand-edited registry files, or a migration that dropped fields.","commonSituations":"Upgrading the tool over an old lane registry; state files edited or partially restored from backup; external code writing lane records without the pinned fields.","solutions":["Find the real session manually (tmux -S <socket> list-sessions across candidate sockets) and kill-session it yourself, then let reconciliation finalize the lane state","Repair the record: restore tmux_socket/tmux_session values if recoverable, then retry the stop","If the lane is obsolete, remove its registry entry through supported paths rather than forcing the transition","Going forward, ensure records are only produced by current runtime versions so metadata stays pinned"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn lane_safe_to_stop(record: &LaneRecord) -> bool {\n    match record.status {\n        LaneStatus::Running => record.tmux_socket.is_some() && record.tmux_session.is_some(),\n        _ => true,\n    }\n}\n\nif !lane_safe_to_stop(&record) {\n    // repair metadata or stop the session manually before calling stop()\n}","typeGuard":"fn lane_has_pinned_session(record: &LaneRecord) -> bool {\n    record.tmux_socket.is_some() && record.tmux_session.is_some()\n}","tryCatchPattern":null,"preventionTips":["Always create tmux lanes through the current runtime so socket/session are pinned at start","Never hand-edit registry records; migrations should preserve tmux_socket/tmux_session","After upgrades, reconcile legacy Running lanes explicitly before depending on stop"],"tags":["rust","lane","tmux","stop","metadata","safety-guard"],"backgroundTag":"missing-metadata-refusal","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}