{"record":{"id":"f650869028337db0","repo":"Hmbown/CodeWhale","slug":"failed-to-run-label-e","errorCode":null,"errorMessage":"Failed to run {label}: {e}","messagePattern":"Failed to run (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/clipboard.rs","lineNumber":537,"sourceCode":"        text,\n        \"Set-Clipboard\",\n    )\n}\n\n#[cfg(all(any(target_os = \"macos\", target_os = \"windows\"), not(test)))]\nfn write_text_with_stdin_command(\n    program: &str,\n    args: &[&str],\n    text: &str,\n    label: &str,\n) -> Result<()> {\n    let mut child = Command::new(program)\n        .args(args)\n        .stdin(Stdio::piped())\n        .stdout(Stdio::null())\n        .stderr(Stdio::null())\n        .spawn()\n        .map_err(|e| anyhow::anyhow!(\"Failed to run {label}: {e}\"))?;\n    if let Some(mut stdin) = child.stdin.take() {\n        stdin\n            .write_all(text.as_bytes())\n            .map_err(|e| anyhow::anyhow!(\"Failed to write to {label}: {e}\"))?;\n    }\n    let _ = std::thread::Builder::new()\n        .name(\"clipboard-wait\".to_string())\n        .spawn(move || {\n            let _ = child.wait();\n        });\n    Ok(())\n}\n\n#[cfg(all(target_os = \"linux\", not(target_env = \"ohos\"), not(test)))]\nfn write_text_with_wlcopy(text: &str) -> Result<()> {\n    write_text_with_wlcopy_using_argv(\"wl-copy\", text)\n}\n","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/clipboard.rs#L519-L555","documentation":"write_text_with_stdin_command (used for macOS pbcopy and Windows `powershell.exe -NoProfile -Command Set-Clipboard -Value $input`) could not spawn the helper process. The OS error names the cause: typically NotFound (binary not on the TUI process's PATH), PermissionDenied, or a fork/exec resource limit. Inside the fallback chain, this error is swallowed unless every later transport also fails.","triggerScenarios":"Command::new(program).spawn() returns Err for pbcopy/powershell.exe: the binary is absent from PATH in the TUI's environment, not executable, blocked by a macOS sandbox policy, or the process limit is exhausted.","commonSituations":"PATH stripped by launcher/service/wrapper scripts; hardened macOS sandboxing; PowerShell relocated or not on PATH on Windows; containers with minimal images.","solutions":["Run `which pbcopy` (macOS) or `where powershell.exe` (Windows) in the exact environment the TUI launches from","Fix the launch environment so PATH includes /usr/bin:/bin (macOS) or the WindowsPowerShell System32 dir","Repair the install: pbcopy ships with macOS, so a missing binary signals a broken system","Rely on the terminal-client fallback instead: use an OSC 52-capable terminal or tmux"],"exampleFix":"# before: wrapper strips PATH\nPATH=/custom/bin codewhale tui\n# -> Failed to run pbcopy: No such file or directory (os error 2)\n\n# after\nPATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH codewhale tui","handlingStrategy":"validation","validationCode":"// Rust - preflight helper availability before relying on it\nfn helper_available(program: &str) -> bool {\n    std::process::Command::new(program)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::null())\n        .stderr(std::process::Stdio::null())\n        .status()\n        .is_ok()\n}","typeGuard":null,"tryCatchPattern":"if !helper_available(\"pbcopy\") { use_osc52_fallback(); } else { /* proceed */ }","preventionTips":["Launch the TUI with an inherited, standard PATH (no stripped wrapper environments)","Smoke-test platform helpers after system upgrades","Treat helper spawn failure as 'fall through to next transport', never as fatal"],"tags":["clipboard","subprocess","spawn","path","macos","windows"],"backgroundTag":"process-spawn-failed","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}