{"record":{"id":"d6a155401d11b4d2","repo":"gitui-org/gitui","slug":"command","errorCode":null,"errorMessage":"`{command:?}`","messagePattern":"`\\{command:\\?\\}`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/clipboard.rs","lineNumber":32,"sourceCode":"\t\t.ok()\n\t\t.unwrap_or_else(|| PathBuf::from(command));\n\n\tlet mut process = Command::new(binary)\n\t\t.args(args)\n\t\t.stdin(Stdio::piped())\n\t\t.stdout(Stdio::null())\n\t\t.stderr(if pipe_stderr {\n\t\t\tStdio::piped()\n\t\t} else {\n\t\t\tStdio::null()\n\t\t})\n\t\t.spawn()\n\t\t.map_err(|e| anyhow!(\"`{command:?}`: {e:?}\"))?;\n\n\tprocess\n\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}","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/gitui-org/gitui/blob/2fa693cb6ed431b21ebc300dd02e83c2476699ce/src/clipboard.rs#L14-L50","documentation":"After spawning the clipboard process with .stdin(Stdio::piped()), the code reaches for process.stdin. That Option can only be None if the child was spawned without piped stdin - an invariant violation between the spawn configuration shown and std's Child handle, not an environmental condition. With the given spawn options this branch is effectively unreachable; encountering it indicates a std-level inconsistency or a local modification that dropped the piped stdin.","triggerScenarios":"Effectively unreachable in shipped gitui builds; would require refactoring the spawn options away from Stdio::piped() while keeping this access, or a bug in std's Child construction.","commonSituations":"Only when hacking on gitui's clipboard module and changing the Stdio configuration; not observed in the field.","solutions":["If you modified the spawn options, keep .stdin(Stdio::piped()) and take the handle before calling wait_with_output().","Upgrade gitui - the clipboard module was reworked in later releases with OSC 52 terminal-escape support.","File an upstream issue with the panic location and trace if it reproduces on an unmodified current build."],"exampleFix":"// before\nlet mut process = Command::new(binary).stdin(Stdio::piped()).spawn()?;\nprocess.stdin.as_mut().ok_or_else(|| anyhow!(\"`{command:?}`\"))?.write_all(text.as_bytes())?;\n// after: take() once, drop to signal EOF\nlet mut stdin = process.stdin.take().ok_or_else(|| anyhow!(\"`{command:?}`\"))?;\nstdin.write_all(text.as_bytes())?;\ndrop(stdin); // close so providers like xclip see EOF and flush","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["When spawning with piped stdio, use Child::stdin.take() before interacting and drop it to signal EOF.","Keep the Stdio configuration and the Child field access adjacent so refactors cannot desynchronize them.","Wrap clipboard operations so any internal failure degrades to a no-op with a log line."],"tags":["clipboard","stdin","invariant","unreachable","subprocess"],"backgroundTag":null,"analyzedSha":"2fa693cb6ed431b21ebc300dd02e83c2476699ce","analyzedAt":"2026-08-16T23:07:36.562Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}