{"record":{"id":"ea8ec6823ec57a9d","repo":"gitui-org/gitui","slug":"command-msg","errorCode":null,"errorMessage":"`{command:?}`: {msg}","messagePattern":"`\\{command:\\?\\}`: \\{msg\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/clipboard.rs","lineNumber":48,"sourceCode":"\t\t.stdin\n\t\t.as_mut()\n\t\t.ok_or_else(|| anyhow!(\"`{command:?}`\"))?\n\t\t.write_all(text.as_bytes())\n\t\t.map_err(|e| anyhow!(\"`{command:?}`: {e:?}\"))?;\n\n\tlet out = process\n\t\t.wait_with_output()\n\t\t.map_err(|e| anyhow!(\"`{command:?}`: {e:?}\"))?;\n\n\tif out.status.success() {\n\t\tOk(())\n\t} else {\n\t\tlet msg = if out.stderr.is_empty() {\n\t\t\tformat!(\"{}\", out.status).into()\n\t\t} else {\n\t\t\tString::from_utf8_lossy(&out.stderr)\n\t\t};\n\t\tErr(anyhow!(\"`{command:?}`: {msg}\"))\n\t}\n}\n\n// Implementation taken from https://crates.io/crates/wsl.\n// Using /proc/sys/kernel/osrelease as an authoritative source\n// based on this comment: https://github.com/microsoft/WSL/issues/423#issuecomment-221627364\n#[cfg(all(target_family = \"unix\", not(target_os = \"macos\")))]\nfn is_wsl() -> bool {\n\tif let Ok(b) = std::fs::read(\"/proc/sys/kernel/osrelease\") {\n\t\tif let Ok(s) = std::str::from_utf8(&b) {\n\t\t\tlet a = s.to_ascii_lowercase();\n\t\t\treturn a.contains(\"microsoft\") || a.contains(\"wsl\");\n\t\t}\n\t}\n\tfalse\n}\n\n// Copy text using escape sequence Ps = 5 2.","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/gitui-org/gitui/blob/2fa693cb6ed431b21ebc300dd02e83c2476699ce/src/clipboard.rs#L30-L66","documentation":"The clipboard provider spawned successfully, ran to completion, but exited with a non-zero status. gitui formats the child's captured stderr (when pipe_stderr was enabled and stderr is non-empty) or the bare ExitStatus into the message, so the provider's own diagnosis - typically xclip's 'Error: Can't open display' or wl-copy's compositor complaints - is visible inside the braces.","triggerScenarios":"xclip running with DISPLAY unset or pointing at a dead server; wl-copy with no compositor listening on the Wayland socket; termux-clipboard-set without the termux-api app side installed; clip.exe under WSL with Windows interop disabled by hardening.","commonSituations":"Copying over ssh after the remote display session died; headless hosts reached from a terminal that does not support OSC 52; WSL images hardened with interop removed; Termux without termux-api.","solutions":["Run the exact command shown in the error message by hand (echo hi | <command>) and read its stderr - it states the root cause.","Fix the environment it complains about: export DISPLAY=:0, restart the compositor, re-enable WSL interop, install termux-api.","Switch to the provider matching your session (wl-clipboard on Wayland) or run gitui inside the graphical session.","For ssh-only workflows, use a terminal supporting OSC 52 clipboard escapes so gitui can copy without a local socket."],"exampleFix":"# error shows the tool's own stderr, e.g.\n# `\"xclip -selection clipboard\": Error: Can't open display: :1. (null)`\n# before\nssh host gitui            # copy fails inside popup\n# after: forward X and ensure the remote has a provider\nssh -X host\nsudo apt install xclip && gitui","handlingStrategy":"validation","validationCode":"# validate the full path - spawn AND exit status - in the session gitui will use\nprintf ok | xclip -selection clipboard && echo 'X11 clipboard works'\nprintf ok | wl-copy && echo 'wayland clipboard works'\n[ -n \"$DISPLAY${WAYLAND_DISPLAY:-}\" ] || echo 'no display env: providers will fail'","typeGuard":null,"tryCatchPattern":"match copy(text) {\n    Err(e) => { show_msg(format!(\"clipboard: {e}\")); Ok(()) } // message embeds provider stderr\n    r => r,\n}","preventionTips":["Smoke-test the clipboard pipe after switching sessions or ssh-ing before relying on TUI copy keys.","On WSL keep interop enabled or install win32yank; on Termux install termux-api.","Read the embedded stderr in the message - it is the provider's own diagnosis."],"tags":["clipboard","non-zero-exit","wayland","x11","wsl","external-tool"],"backgroundTag":"clipboard-command-failed","analyzedSha":"2fa693cb6ed431b21ebc300dd02e83c2476699ce","analyzedAt":"2026-08-16T23:07:36.562Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}