{"record":{"id":"69bbc86ecb95c4e7","repo":"openai/codex","slug":"duplicate-thread-start-for-thread-id","errorCode":null,"errorMessage":"duplicate thread start for {thread_id}","messagePattern":"duplicate thread start for (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rollout-trace/src/reducer/thread.rs","lineNumber":39,"sourceCode":"use crate::model::RolloutStatus;\nuse crate::payload::RawPayloadRef;\nuse crate::raw_event::RawEventSeq;\n\nimpl TraceReducer {\n    /// Inserts a thread and derives its multi-agent identity from optional metadata.\n    ///\n    /// The raw event carries a denormalized agent path; when v2 subagent metadata is\n    /// present, that metadata is authoritative because it also drives spawn edges and task names.\n    pub(super) fn start_thread(\n        &mut self,\n        seq: RawEventSeq,\n        wall_time_unix_ms: i64,\n        thread_id: String,\n        agent_path: String,\n        metadata_payload: Option<RawPayloadRef>,\n    ) -> Result<()> {\n        if self.rollout.threads.contains_key(&thread_id) {\n            bail!(\"duplicate thread start for {thread_id}\");\n        }\n\n        let metadata = metadata_payload\n            .as_ref()\n            .map(|payload| self.thread_started_metadata(payload))\n            .transpose()?;\n        let spawn = metadata\n            .as_ref()\n            .and_then(ThreadStartedMetadata::thread_spawn);\n        // The v2 SessionSource is the authoritative child identity record.\n        // Prefer its nested agent_path over the denormalized event field so\n        // task derivation and the spawn edge are based on the same metadata.\n        let agent_path = spawn\n            .as_ref()\n            .and_then(|spawn| spawn.agent_path.clone())\n            .or_else(|| {\n                metadata\n                    .as_ref()","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rollout-trace/src/reducer/thread.rs#L21-L57","documentation":"Error \"duplicate thread start for {thread_id}\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/rollout-trace/src/reducer/thread.rs:39 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"}