Hmbown/CodeWhale · error
tmux load-buffer -w exited with
Error message
tmux load-buffer -w exited with {}: {detail} What it means
The detailed variant of the tmux clipboard failure: when `tmux load-buffer -w` exits nonzero and stderr contains text, that trimmed stderr is appended to the message. This gives the actual tmux diagnostic (e.g. why `-w` failed or why the buffer could not be created) alongside the exit status.
Solutions
- Read the stderr detail in the message and fix the named tmux condition (e.g. enable `set-clipboard on` or `allow-passthrough` in `~/.tmux.conf`)
- Upgrade tmux if the detail indicates `-w` is unknown
- Verify the TMUX socket/session is healthy by running the load-buffer command manually
- Fall back to a system clipboard helper when tmux refuses the write
Example fix
// before
match err.to_string() { ... } // opaque
// after
// message now contains the tmux stderr, e.g.:
// "tmux load-buffer -w exited with exit status: 1: clipboard unavailable" — fix per detail Defensive patterns
Strategy: try-catch
Try / catch
match clipboard.write_text_with_tmux(text) {
Err(e) => {
let msg = e.to_string();
if let Some(detail) = msg.split_once(": ").map(|(_, d)| d) {
log::error!("tmux diagnostic: {detail}"); // act on the tmux stderr
}
clipboard.write_text(text).ok();
}
Ok(()) => {},
} Prevention
- Read and act on the tmux stderr embedded in the message instead of retrying blindly
- Enable `set-clipboard` / `allow-passthrough` in ~/.tmux.conf as the message's detail suggests
- Keep tmux current — many stderr diagnostics indicate version-specific `-w` issues
- Test the tmux copy path after changing tmux config
When it happens
Trigger: Calling `write_text_with_tmux` when tmux exits nonzero AND writes a diagnostic to stderr — e.g. `load-buffer -w` failing to set the clipboard of the attached client, passthrough issues, or an invalid socket/session state.
Common situations: tmux 3.2+ but `set-clipboard` disabled server-side; `allow-passthrough` off with prefix passthrough expectations; permission denied on the tmux socket; reading the message to diagnose why the attached terminal did not receive the copy.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- tmux load-buffer -w exited with
- Failed to run tmux load-buffer -w
- exited with
- exited with
- another terminal clipboard write is still queued
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/97727b825ee9d855.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tui/clipboard.rs:802
.stdin
.take()
.context("open tmux clipboard input")
.and_then(|mut stdin| {
stdin
.write_all(text.as_bytes())
.context("write tmux clipboard input")
});
let output = child
.wait_with_output()
.context("wait for tmux load-buffer -w")?;
write_result?;
if !output.status.success() {
let detail = String::from_utf8_lossy(&output.stderr);
let detail = detail.trim();
if detail.is_empty() {
bail!("tmux load-buffer -w exited with {}", output.status);
}
bail!(
"tmux load-buffer -w exited with {}: {detail}",
output.status
);
}
Ok(())
}
#[cfg(not(test))]
fn write_text_with_osc52(text: &str) -> Result<()> {
let mut stdout = io::stdout();
if !stdout.is_terminal() {
bail!("OSC 52 clipboard fallback requires a terminal");
}
let sequence = osc52_sequence(text)?;
stdout
.write_all(sequence.as_bytes())
.context("write OSC 52 clipboard sequence")?;View on GitHub (pinned to 73e0f67d83)