{"record":{"id":"c29ae73c88d08450","repo":"Hmbown/CodeWhale","slug":"tmux-load-buffer-w-exited-with","errorCode":null,"errorMessage":"tmux load-buffer -w exited with {}","messagePattern":"tmux load-buffer -w exited with (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/tui/src/tui/clipboard.rs","lineNumber":645,"sourceCode":"\n    let write_result = child\n        .stdin\n        .take()\n        .context(\"open tmux clipboard input\")\n        .and_then(|mut stdin| {\n            stdin\n                .write_all(text.as_bytes())\n                .context(\"write tmux clipboard input\")\n        });\n    let output = child\n        .wait_with_output()\n        .context(\"wait for tmux load-buffer -w\")?;\n    write_result?;\n    if !output.status.success() {\n        let detail = String::from_utf8_lossy(&output.stderr);\n        let detail = detail.trim();\n        if detail.is_empty() {\n            bail!(\"tmux load-buffer -w exited with {}\", output.status);\n        }\n        bail!(\n            \"tmux load-buffer -w exited with {}: {detail}\",\n            output.status\n        );\n    }\n    Ok(())\n}\n\n#[cfg(not(test))]\nfn write_text_with_osc52(text: &str) -> Result<()> {\n    let mut stdout = io::stdout();\n    if !stdout.is_terminal() {\n        bail!(\"OSC 52 clipboard fallback requires a terminal\");\n    }\n\n    let sequence = osc52_sequence(text)?;\n    stdout","sourceCodeStart":627,"sourceCodeEnd":663,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/clipboard.rs#L627-L663","documentation":"The tmux clipboard path ran 'tmux load-buffer -w -' and it exited nonzero with empty stderr, so only the exit status is reported. Empty stderr typically means tmux could not even report a reason: lost connection to the server, stale TMUX environment variables pointing at a dead socket, or a tmux too old to support '-w' (the wait/wayland-related flag needs tmux >= 3.2).","triggerScenarios":"Copy while the tmux server is being killed or restarted; a stale $TMUX/$TMUX_PANE inherited from a detached session; tmux older than 3.2 where load-buffer rejects -w silently.","commonSituations":"Long-lived shells reusing a tmux env after 'tmux kill-server'; distros shipping tmux 3.0/3.1; nesting terminal multiplexers; scripts that inherit tmux variables without a live server.","solutions":["Verify the server and version in the failing environment: tmux -V (needs >= 3.2) and tmux list-sessions.","Restart or reattach to a live tmux session so $TMUX points at a reachable socket, then retry the copy.","On tmux < 3.2, upgrade tmux, or use a system clipboard utility so the tmux path is not exercised."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"fn tmux_load_buffer_supported() -> bool {\n    std::env::var_os(\"TMUX\").is_some()\n        && Command::new(\"tmux\").arg(\"-V\").output()\n            .map(|o| String::from_utf8_lossy(&o.stdout).trim().split('.').nth(1).and_then(|mi| mi.parse::<u32>().ok()).map(|mi| mi >= 2).unwrap_or(false))\n            .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match write_text_with_tmux(text) {\n    Err(e) if e.to_string().contains(\"tmux load-buffer -w exited\") => {\n        write_text_with_osc52(text) // server gone: use direct OSC 52\n    }\n    other => other,\n}","preventionTips":["Require tmux >= 3.2 in environments that rely on load-buffer -w.","Unset stale TMUX/TMUX_PANE when detaching, or restart the server before copying.","Check tmux -V during setup and warn early rather than failing at copy time."],"tags":["clipboard","tmux","external-tool","rust"],"backgroundTag":"clipboard-write-failed","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}