openai/codex · error · anyhow::Error

duplicate thread start for {thread_id}

Error message

duplicate thread start for {thread_id}

What it means

Error "duplicate thread start for {thread_id}" thrown in openai/codex.

Source

Thrown at codex-rs/rollout-trace/src/reducer/thread.rs:39

use crate::model::RolloutStatus;
use crate::payload::RawPayloadRef;
use crate::raw_event::RawEventSeq;

impl TraceReducer {
    /// Inserts a thread and derives its multi-agent identity from optional metadata.
    ///
    /// The raw event carries a denormalized agent path; when v2 subagent metadata is
    /// present, that metadata is authoritative because it also drives spawn edges and task names.
    pub(super) fn start_thread(
        &mut self,
        seq: RawEventSeq,
        wall_time_unix_ms: i64,
        thread_id: String,
        agent_path: String,
        metadata_payload: Option<RawPayloadRef>,
    ) -> Result<()> {
        if self.rollout.threads.contains_key(&thread_id) {
            bail!("duplicate thread start for {thread_id}");
        }

        let metadata = metadata_payload
            .as_ref()
            .map(|payload| self.thread_started_metadata(payload))
            .transpose()?;
        let spawn = metadata
            .as_ref()
            .and_then(ThreadStartedMetadata::thread_spawn);
        // The v2 SessionSource is the authoritative child identity record.
        // Prefer its nested agent_path over the denormalized event field so
        // task derivation and the spawn edge are based on the same metadata.
        let agent_path = spawn
            .as_ref()
            .and_then(|spawn| spawn.agent_path.clone())
            .or_else(|| {
                metadata
                    .as_ref()

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/rollout-trace/src/reducer/thread.rs:39 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/69bbc86ecb95c4e7. Report an issue: GitHub.