tinyhumansai/openhuman · error · anyhow::Error
stdio MCP session not initialized
Error message
stdio MCP session not initialized
What it means
Internal state guard in list_tools: after initialize() the per-client session slot was still empty. Indicates initialize returned without storing the session (or the session was dropped between steps), so the shared state machine is out of order.
Source
Thrown at src/openhuman/mcp/config_servers/stdio.rs:156
}
}),
)
.await?;
let init: McpInitializeResult =
serde_json::from_value(response).context("parsing stdio initialize result")?;
self.send_notification_on_session(&mut session, "notifications/initialized", json!({}))
.await?;
session.initialize = init.clone();
*state = Some(session);
Ok(init)
}
pub async fn list_tools(&self) -> anyhow::Result<Vec<McpRemoteTool>> {
self.initialize().await?;
let mut state = self.state.lock().await;
let session = state
.as_mut()
.ok_or_else(|| anyhow::anyhow!("stdio MCP session not initialized"))?;
let response = self
.send_request_on_session(session, "tools/list", json!({}))
.await?;
serde_json::from_value(
response
.get("tools")
.cloned()
.ok_or_else(|| anyhow::anyhow!("stdio tools/list response missing `tools`"))?,
)
.context("parsing stdio tools/list payload")
}
pub async fn call_tool(
&self,
name: &str,
arguments: Value,
) -> anyhow::Result<McpServerToolResult> {
self.initialize().await?;View on GitHub (pinned to 7491200858)
Solutions
- Retry the call — initialize() runs first and normally populates the session on the second attempt
- Check whether the MCP server closed the connection during initialize, dropping the stored session
- Inspect logs for a failed initialize handshake that left state=None
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/openhuman/mcp/config_servers/stdio.rs:156 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/6dcaa1f98d8b2c5a.
Report an issue: GitHub.