{"record":{"id":"468de7f0eb3372df","repo":"openai/codex","slug":"tool-call-start-referenced-unknown-thread-thread","errorCode":null,"errorMessage":"tool call start referenced unknown thread {thread_id}","messagePattern":"tool call start referenced unknown thread (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/rollout-trace/src/reducer/tool.rs","lineNumber":394,"sourceCode":"    ) -> Result<String> {\n        if let Some(thread_id) = thread_id {\n            return Ok(thread_id);\n        }\n        let Some(codex_turn_id) = codex_turn_id else {\n            bail!(\"tool call start did not include thread or Codex turn context\");\n        };\n        self.rollout\n            .codex_turns\n            .get(codex_turn_id)\n            .map(|turn| turn.thread_id.clone())\n            .with_context(|| {\n                format!(\"tool call start referenced unknown Codex turn {codex_turn_id}\")\n            })\n    }\n\n    fn validate_tool_turn(&self, thread_id: &str, codex_turn_id: Option<&str>) -> Result<()> {\n        if !self.rollout.threads.contains_key(thread_id) {\n            bail!(\"tool call start referenced unknown thread {thread_id}\");\n        }\n        if let Some(codex_turn_id) = codex_turn_id {\n            let Some(turn) = self.rollout.codex_turns.get(codex_turn_id) else {\n                bail!(\"tool call start referenced unknown Codex turn {codex_turn_id}\");\n            };\n            if turn.thread_id != thread_id {\n                bail!(\n                    \"tool call start used thread {thread_id}, but Codex turn {codex_turn_id} \\\n                     belongs to {}\",\n                    turn.thread_id\n                );\n            }\n        }\n        Ok(())\n    }\n\n    fn ensure_unique_model_visible_tool_call(\n        &self,","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rollout-trace/src/reducer/tool.rs#L376-L412","documentation":"Error \"tool call start referenced unknown thread {thread_id}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/rollout-trace/src/reducer/tool.rs:394 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}