tui-cs/Terminal.Gui · error · NotSupportedException
"{_xclipPath} {xclipArgs} < {text}" failed
Error message
"{_xclipPath} {xclipArgs} < {text}" failed What it means
Thrown by UnixClipboard.SetClipboardDataImpl when invoking xclip to write to the clipboard selection raises an exception, wrapping the original. It is a NotSupportedException. Note the message interpolates the text being set, which can leak clipboard contents into logs; xclip was found at construction (IsSupported true) but the write failed at runtime.
Source
Thrown at Terminal.Gui/Drivers/UnixHelpers/UnixClipboard.cs:59
finally
{
File.Delete (tempFileName);
}
return string.Empty;
}
protected override void SetClipboardDataImpl (string text)
{
string xclipArgs = "-selection clipboard -i";
try
{
_processRunner.Bash ($"{_xclipPath} {xclipArgs}", text);
}
catch (Exception e)
{
throw new NotSupportedException ($"\"{_xclipPath} {xclipArgs} < {text}\" failed", e);
}
}
private bool CheckSupport ()
{
#pragma warning disable RCS1075 // Avoid empty catch clause that catches System.Exception.
try
{
(int exitCode, string result) = _processRunner.Bash ("which xclip", waitForOutput: true);
if (exitCode == 0 && result.FileExists ())
{
_xclipPath = result;
return true;
}
}
catch (Exception)View on GitHub (pinned to 2e47b11478)
Solutions
- Check Clipboard.IsSupported before calling SetText and skip silently if unsupported.
- Ensure a usable X session (DISPLAY set, ssh -X, or XWayland).
- Verify manually: `echo test | xclip -selection clipboard -i`.
Example fix
// before
Clipboard.SetText(value);
// after
if (Clipboard.IsSupported)
Clipboard.SetText(value); Defensive patterns
Strategy: fallback
Validate before calling
if (!Clipboard.IsSupported) return;
Type guard
static bool ClipboardReady() => Clipboard.IsSupported;
Try / catch
try { Clipboard.SetText(value); } catch (NotSupportedException) { /* ignore; clipboard unavailable */ } Prevention
- Check Clipboard.IsSupported before SetText.
- Avoid clipboard dependency in CI/headless environments.
- Be aware the exception message includes the text being set (log hygiene).
When it happens
Trigger: Calling Clipboard.SetText (or SetClipboardDataImpl) on Linux when xclip is installed but the write fails: no X display, not in an X/Wayland session, permission denied, or xclip killed mid-write.
Common situations: SSH sessions without X forwarding, headless/CI boxes, Wayland without XWayland, or environments where xclip cannot reach a clipboard daemon.
Related errors
- "{_xclipPath} {xclipArgs}" failed.
- Failed to copy from the OS clipboard.
- Failed to paste to the OS clipboard.
- Process timed out. Command line: {process.StartInfo.FileName
- Failed to get screenBuffer console mode, error code: {Marsha
AI-assisted analysis of tui-cs/Terminal.Gui@2e47b11478 (2026-08-13).
Data as JSON: /api/errors/21e12a31ba0f1044.
Report an issue: GitHub.