{"record":{"id":"01dd89ffa0b0ad2c","repo":"openai/codex","slug":"either-threadid-or-conversationid-must-be-provided","errorCode":null,"errorMessage":"either threadId or conversationId must be provided","messagePattern":"either threadId or conversationId must be provided","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/mcp-server/src/codex_tool_config.rs","lineNumber":215,"sourceCode":"    /// This field is required, but we keep it optional here for backward\n    /// compatibility for clients that still use conversationId.\n    #[serde(default, skip_serializing_if = \"Option::is_none\")]\n    thread_id: Option<String>,\n\n    /// The *next user prompt* to continue the Codex conversation.\n    pub prompt: String,\n}\n\nimpl CodexToolCallReplyParam {\n    pub(crate) fn get_thread_id(&self) -> anyhow::Result<ThreadId> {\n        if let Some(thread_id) = &self.thread_id {\n            let thread_id = ThreadId::from_string(thread_id)?;\n            Ok(thread_id)\n        } else if let Some(conversation_id) = &self.conversation_id {\n            let thread_id = ThreadId::from_string(conversation_id)?;\n            Ok(thread_id)\n        } else {\n            Err(anyhow::anyhow!(\n                \"either threadId or conversationId must be provided\"\n            ))\n        }\n    }\n}\n\n/// Builds a `Tool` definition for the `codex-reply` tool-call.\npub(crate) fn create_tool_for_codex_tool_call_reply_param() -> Tool {\n    let schema = SchemaSettings::draft2019_09()\n        .with(|s| {\n            s.inline_subschemas = true;\n            s.option_add_null_type = false;\n        })\n        .into_generator()\n        .into_root_schema_for::<CodexToolCallReplyParam>();\n\n    let input_schema = create_tool_input_schema(schema, \"Codex reply tool schema should serialize\");\n","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/mcp-server/src/codex_tool_config.rs#L197-L233","documentation":"CodexToolCallReplyParam::get_thread_id found neither thread_id nor the legacy conversation_id on the MCP tool call reply, so there is no conversation to continue. thread_id is the required modern field; conversation_id is tolerated only for backward compatibility.","triggerScenarios":"Thrown at codex-rs/mcp-server/src/codex_tool_config.rs:215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set threadId on the tool call reply to the id returned when the session was created","Legacy clients should migrate from conversationId to threadId","Validate outgoing replies before sending so missing ids fail fast client-side"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}