{"record":{"id":"78acfe562d3167b8","repo":"GitoxideLabs/gitoxide","slug":"configured-beforehand","errorCode":null,"errorMessage":"configured beforehand","messagePattern":"configured beforehand","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-transport/src/client/blocking_io/file.rs","lineNumber":311,"sourceCode":"                let (cmd, cmd_name) = self.prepare_fallback_command(service);\n                let mut cmd = into_std_command(cmd);\n                gix_features::trace::debug!(command = ?cmd, \"gix_transport::SpawnProcessOnDemand (fallback)\");\n                cmd.spawn().map_err(|err| client::Error::InvokeProgram {\n                    source: err,\n                    command: cmd_name,\n                })?\n            }\n            Err(err) => {\n                return Err(client::Error::InvokeProgram {\n                    source: err,\n                    command: cmd_name,\n                });\n            }\n        };\n        let stdout: Box<dyn std::io::Read + Send> = match ssh_kind {\n            Some(ssh_kind) => Box::new(supervise_stderr(\n                ssh_kind,\n                child.stderr.take().expect(\"configured beforehand\"),\n                child.stdout.take().expect(\"configured\"),\n            )),\n            None => Box::new(child.stdout.take().expect(\"stdout configured\")),\n        };\n        self.connection = Some(Connection::new_for_spawned_process(\n            stdout,\n            child.stdin.take().expect(\"stdin configured\"),\n            self.desired_version,\n            self.path.clone(),\n            self.trace,\n        ));\n        self.child = Some(child);\n        self.connection\n            .as_mut()\n            .expect(\"connection to be there right after setting it\")\n            .handshake(service, extra_parameters)\n    }\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-transport/src/client/blocking_io/file.rs#L293-L329","documentation":"Panic from `child.stderr.take().expect(\"configured beforehand\")` in the blocking file transport's `handshake`. When SSH is used, the code asserts the spawned child has a piped stderr, which requires `Command::stderr(Stdio::piped())` to have been called before `spawn()`. The panic fires only if the spawn setup forgot to configure stderr — an internal setup invariant, not user input.","triggerScenarios":"Performing a handshake over an SSH remote (ssh_kind present) when the child process was spawned without `Stdio::piped()` for stderr, e.g. in a patched build or after changes to the spawn code path.","commonSituations":"Custom ssh_cmd wrappers or forks that alter process spawning; regressions in gix-transport after refactoring the SSH invocation.","solutions":["Ensure the code path that spawns the SSH child calls `.stderr(Stdio::piped())` (and stdout/stdin) before `spawn()`.","Upgrade gix-transport to a version where SSH spawn configures all pipes.","If using a custom `GIT_SSH_COMMAND` wrapper, verify the failure isn't from a locally modified transport build."],"exampleFix":"// before\nlet child = cmd.spawn()?; // stderr not piped\n// after\nlet child = cmd.stderr(Stdio::piped()).stdout(Stdio::piped()).stdin(Stdio::piped()).spawn()?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"std::panic::catch_unwind(AssertUnwindSafe(|| handshake(...)))\n    .map_err(|_| anyhow::anyhow!(\"SSH handshake panicked: stderr pipe not configured\"))?","preventionTips":["Always pipe stdout/stderr/stdin via Stdio::piped() before spawn in any custom transport code","Avoid modifying the SSH spawn path in forks without testing SSH remotes","Test against an SSH remote in CI when touching transport code"],"tags":["rust","panic","internal-invariant","ssh","process-spawn"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}