openai/codex · error · anyhow::Error

inference start used thread , but codex turn belongs to

Error message

inference start {inference_call_id} used thread {thread_id}, but codex turn {codex_turn_id} belongs to {}

What it means

The thread_id on the inference start disagrees with the thread that owns the referenced codex turn, indicating inconsistent denormalized ids in the raw event.

Solutions

  1. Fix the producer to emit consistent thread/turn ids
  2. Trust the turn's owning thread and warn instead of failing
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/rollout-trace/src/reducer/inference.rs:63 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/a65ef22cc022a14e. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rollout-trace/src/reducer/inference.rs:63

            .contains_key(&started.inference_call_id)
        {
            bail!(
                "duplicate inference start for {}",
                started.inference_call_id
            );
        }

        let inference_call_id = started.inference_call_id.clone();
        let thread_id = started.thread_id.clone();
        let codex_turn_id = started.codex_turn_id.clone();
        let request_payload = started.request_payload.clone();
        let Some(turn) = self.rollout.codex_turns.get(&codex_turn_id) else {
            bail!(
                "inference start {inference_call_id} referenced unknown codex turn {codex_turn_id}"
            );
        };
        if turn.thread_id != thread_id {
            bail!(
                "inference start {inference_call_id} used thread {thread_id}, \
                 but codex turn {codex_turn_id} belongs to {}",
                turn.thread_id
            );
        }

        let request_item_ids = self.reduce_inference_request(
            wall_time_unix_ms,
            &inference_call_id,
            &thread_id,
            &codex_turn_id,
            &request_payload,
        )?;

        self.thread_mut(&thread_id)?;

        self.rollout.inference_calls.insert(
            inference_call_id.clone(),

View on GitHub (pinned to 339751715c)