{"record":{"id":"6dcaa1f98d8b2c5a","repo":"tinyhumansai/openhuman","slug":"stdio-mcp-session-not-initialized","errorCode":null,"errorMessage":"stdio MCP session not initialized","messagePattern":"stdio MCP session not initialized","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/mcp/config_servers/stdio.rs","lineNumber":156,"sourceCode":"                    }\n                }),\n            )\n            .await?;\n        let init: McpInitializeResult =\n            serde_json::from_value(response).context(\"parsing stdio initialize result\")?;\n        self.send_notification_on_session(&mut session, \"notifications/initialized\", json!({}))\n            .await?;\n        session.initialize = init.clone();\n        *state = Some(session);\n        Ok(init)\n    }\n\n    pub async fn list_tools(&self) -> anyhow::Result<Vec<McpRemoteTool>> {\n        self.initialize().await?;\n        let mut state = self.state.lock().await;\n        let session = state\n            .as_mut()\n            .ok_or_else(|| anyhow::anyhow!(\"stdio MCP session not initialized\"))?;\n        let response = self\n            .send_request_on_session(session, \"tools/list\", json!({}))\n            .await?;\n        serde_json::from_value(\n            response\n                .get(\"tools\")\n                .cloned()\n                .ok_or_else(|| anyhow::anyhow!(\"stdio tools/list response missing `tools`\"))?,\n        )\n        .context(\"parsing stdio tools/list payload\")\n    }\n\n    pub async fn call_tool(\n        &self,\n        name: &str,\n        arguments: Value,\n    ) -> anyhow::Result<McpServerToolResult> {\n        self.initialize().await?;","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/mcp/config_servers/stdio.rs#L138-L174","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/mcp/config_servers/stdio.rs:156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}