{"record":{"id":"c6f1f7d4758eb03e","repo":"openai/codex","slug":"code-cell-start-used-thread-thread-id-but-codex","errorCode":null,"errorMessage":"code cell start used thread {thread_id}, but Codex turn {codex_turn_id} belongs to {}","messagePattern":"code cell start used thread (.+?), but Codex turn (.+?) belongs to (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rollout-trace/src/reducer/code_cell.rs","lineNumber":648,"sourceCode":"            RawToolCallRequester::CodeCell { runtime_cell_id } => Ok(ToolCallRequester::CodeCell {\n                code_cell_id: self.code_cell_id_for_runtime_cell_id(\n                    thread_id,\n                    &runtime_cell_id,\n                    \"code-mode nested tool\",\n                )?,\n            }),\n        }\n    }\n\n    fn validate_code_cell_turn(&self, thread_id: &str, codex_turn_id: &str) -> Result<()> {\n        if !self.rollout.threads.contains_key(thread_id) {\n            bail!(\"code cell start referenced unknown thread {thread_id}\");\n        }\n        let Some(turn) = self.rollout.codex_turns.get(codex_turn_id) else {\n            bail!(\"code cell start referenced unknown Codex turn {codex_turn_id}\");\n        };\n        if turn.thread_id != thread_id {\n            bail!(\n                \"code cell start used thread {thread_id}, but Codex turn {codex_turn_id} belongs \\\n                 to {}\",\n                turn.thread_id\n            );\n        }\n        Ok(())\n    }\n\n    fn model_visible_code_cell_item_ids(\n        &self,\n        thread_id: &str,\n        call_id: &str,\n        kind: ConversationItemKind,\n    ) -> Vec<String> {\n        self.rollout\n            .conversation_items\n            .values()\n            .filter(|item| {","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rollout-trace/src/reducer/code_cell.rs#L630-L666","documentation":"Error \"code cell start used thread {thread_id}, but Codex turn {codex_turn_id} belongs to {}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/rollout-trace/src/reducer/code_cell.rs:648 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"}