{"record":{"id":"5290c6d2e34ccb4c","repo":"xai-org/grok-build","slug":"bin-exited-with-status-status","errorCode":null,"errorMessage":"{bin} exited with status {status}","messagePattern":"(.+?) exited with status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shared/src/clipboard.rs","lineNumber":1813,"sourceCode":"        // Spooled stdin (`spool_for_stdin`), not a pipe: clipboard tools\n        // (wl-copy/xclip) daemonize and read the payload after forking, racing\n        // a pipe write and possibly leaving the selection empty; the daemon\n        // keeps its fd to the unlinked temp file.\n        let stdin = super::spool_for_stdin(data)?;\n\n        let mut cmd = Command::new(bin);\n        cmd.args(args)\n            .stdin(Stdio::from(stdin))\n            .stdout(Stdio::null())\n            .stderr(Stdio::null());\n        xai_grok_tools::util::detach_std_command(&mut cmd);\n        #[allow(clippy::disallowed_methods)] // short-lived clipboard helper, waited on below\n        let mut child = cmd\n            .spawn()\n            .map_err(|e| anyhow::anyhow!(\"failed to spawn {bin}: {e}\"))?;\n        let status = super::wait_with_deadline(&mut child, CLI_WRITE_WAIT)?;\n        if !status.success() {\n            anyhow::bail!(\"{bin} exited with status {status}\");\n        }\n        Ok(())\n    }\n\n    /// Run a CLI tool and capture its stdout, bounded by `deadline`\n    /// (`CLI_PROBE_WAIT` for read-backs, `CLI_READ_WAIT` for content reads).\n    #[cfg(target_os = \"linux\")]\n    fn run_capture_out_with_status(\n        argv: &[&str],\n        deadline: std::time::Duration,\n    ) -> anyhow::Result<(std::process::ExitStatus, Vec<u8>)> {\n        let (bin, args) = argv.split_first().expect(\"argv non-empty\");\n        let mut cmd = Command::new(bin);\n        cmd.args(args)\n            .stdin(Stdio::null())\n            .stdout(Stdio::piped())\n            .stderr(Stdio::null());\n        xai_grok_tools::util::detach_std_command(&mut cmd);","sourceCodeStart":1795,"sourceCodeEnd":1831,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shared/src/clipboard.rs#L1795-L1831","documentation":"A clipboard CLI write helper (e.g. xclip/xsel/wl-copy in write mode) spawned by the library exited with a non-zero status, so the write failed. The message includes the binary name and exit status; the tool's stderr was not captured on this path.","triggerScenarios":"Calling set_text/set_text_with_outcome on Linux where the chosen CLI tool starts but exits non-zero — e.g. xclip cannot open the X display, wl-copy has no Wayland seat, or the tool aborts on invalid input.","commonSituations":"Wayland/X11 mismatch (running X11 tool under pure Wayland or vice versa), missing DISPLAY/WAYLAND_DISPLAY, misconfigured or crashed clipboard daemons.","solutions":["Run the failing tool manually (e.g. `echo test | wl-copy` or `xclip -selection clipboard`) to see its real error","Ensure DISPLAY (X11) or WAYLAND_DISPLAY (Wayland) is set and matches the session type","Install the tool matching your session: xclip/xsel for X11, wl-clipboard for Wayland","Try another clipboard leg — set_text falls back across multiple backends"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"fn write_tool_available(bin: &str) -> bool {\n    which::which(bin).is_ok()\n}\n// e.g. assert!(write_tool_available(\"wl-copy\") || write_tool_available(\"xclip\"));","typeGuard":null,"tryCatchPattern":"match clipboard::set_text(&text) {\n    Err(e) if e.to_string().contains(\"exited with status\") => {\n        eprintln!(\"clipboard write failed: {e}; retrying once\");\n        std::thread::sleep(std::time::Duration::from_millis(200));\n        clipboard::set_text(&text)\n    }\n    other => other,\n}","preventionTips":["Verify DISPLAY/WAYLAND_DISPLAY match the actual session type (X11 vs Wayland)","Install the tool that matches the session: xclip/xsel for X11, wl-clipboard for Wayland","Run the write command manually once to surface the tool's real stderr","Retry transient failures with a short backoff"],"tags":["clipboard","linux","process"],"backgroundTag":"clipboard-command-failed","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}