openai/codex · error · io::Error
MCP stdin closed
Error message
MCP stdin closed
What it means
Error "MCP stdin closed" thrown in openai/codex.
Source
Thrown at codex-rs/rmcp-client/src/local_stdio_transport.rs:150
impl Transport<RoleClient> for LocalStdioTransport {
type Error = io::Error;
#[expect(
clippy::await_holding_invalid_type,
reason = "complete JSON-RPC frames must hold the stdin lock across writes"
)]
fn send(
&mut self,
item: TxJsonRpcMessage<RoleClient>,
) -> impl Future<Output = Result<(), Self::Error>> + Send + 'static {
let stdin = Arc::clone(&self.stdin);
async move {
let mut message = serde_json::to_vec(&item).map_err(io::Error::other)?;
message.push(b'\n');
let mut guard = stdin.lock().await;
let stdin = guard
.as_mut()
.ok_or_else(|| io::Error::new(io::ErrorKind::BrokenPipe, "MCP stdin closed"))?;
stdin.write_all(&message).await?;
stdin.flush().await
}
}
fn receive(&mut self) -> impl Future<Output = Option<RxJsonRpcMessage<RoleClient>>> + Send {
self.receive_message()
}
async fn close(&mut self) -> Result<(), Self::Error> {
self.stdin.lock().await.take();
match tokio::time::timeout(Duration::from_secs(3), self.child.wait()).await {
Ok(status) => {
status?;
Ok(())
}
Err(_) => self.child.kill().await,
}View on GitHub (pinned to 339751715c)
When it happens
Trigger: Thrown at codex-rs/rmcp-client/src/local_stdio_transport.rs:150 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/1d7ac4e1020ee7db.
Report an issue: GitHub.