{"record":{"id":"5b0eb704766528b2","repo":"tonhowtf/omniget","slug":"clipboard","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src-tauri/omniget-core/src/core/clipboard.rs","lineNumber":82,"sourceCode":"            .stdin(std::process::Stdio::piped())\n            .spawn()\n        {\n            Ok(c) => c,\n            Err(_) => return Err(anyhow::anyhow!(\"xclip not found\")),\n        };\n        if let Some(ref mut stdin) = child.stdin {\n            use std::io::Write;\n            let _ = stdin.write_all(uri_clone.as_bytes());\n        }\n        let output = child.wait_with_output()?;\n        if output.status.success() {\n            Ok(true)\n        } else {\n            Ok(false)\n        }\n    })\n    .await\n    .map_err(|e| anyhow::anyhow!(\"{}\", e))?;\n\n    if let Ok(true) = xclip_result {\n        tracing::info!(\"[clipboard] copied file to clipboard (xclip): {}\", path);\n        return Ok(());\n    }\n\n    let uri_clone = uri.clone();\n    let xsel_result = tokio::task::spawn_blocking(move || {\n        let mut child = match crate::core::process::std_command(\"xsel\")\n            .args([\"--clipboard\", \"--input\"])\n            .stdin(std::process::Stdio::piped())\n            .spawn()\n        {\n            Ok(c) => c,\n            Err(_) => return Err(anyhow::anyhow!(\"xsel not found\")),\n        };\n        if let Some(ref mut stdin) = child.stdin {\n            use std::io::Write;","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/clipboard.rs#L64-L100","documentation":"copy_file_linux runs xclip inside spawn_blocking; any error produced inside that closure (spawn failure, wait failure, IO error) is bubbled up and re-wrapped with a bare '{}' format, so the original message passes through unchanged.","triggerScenarios":"copy_file_to_clipboard on Linux when the xclip blocking task fails for any reason — e.g. clipboard service unavailable, pipe broken after xclip exits early, or the child wait fails.","commonSituations":"xclip starts but exits immediately because no X clipboard owner is available (headless/Wayland), causing a broken pipe on stdin write; transient display issues.","solutions":["Read the inner message in the error for the root cause; usually it's the xclip spawn or pipe error.","Ensure an X display/clipboard server is reachable (DISPLAY is set; XWayland running on Wayland).","Install xsel so the fallback clipboard path can be attempted.","Retry — clipboard daemons sometimes recover after a display-manager restart."],"exampleFix":"// before\nDISPLAY= omniget copy-file report.pdf  # fails, no display\n// after\nDISPLAY=:0 omniget copy-file report.pdf","handlingStrategy":"fallback","validationCode":"if (!process.env.DISPLAY && process.platform === 'linux') {\n  console.warn('DISPLAY is not set; clipboard copy will likely fail');\n}","typeGuard":null,"tryCatchPattern":"match copy_file_to_clipboard(path).await {\n    Err(e) if e.to_string().contains(\"xclip\") => {\n        eprintln!(\"xclip failed: {e}; falling back to xsel or skipping clipboard\");\n    }\n    other => other?,\n}","preventionTips":["Ensure DISPLAY is exported and a clipboard daemon is running before copying","Install both xclip and xsel so one fallback always exists","On Wayland, plan for wl-clipboard instead of X tools"],"tags":["linux","clipboard","process"],"backgroundTag":"clipboard-copy-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}