openai/codex · error · anyhow::Error

did not include a thread id

Error message

{event_name} {runtime_cell_id} did not include a thread id

What it means

Validation guard in code_cell_event_thread_id: a code-cell runtime event carried neither a thread id nor a resolvable turn id, so its owning thread cannot be determined. The malformed runtime event named by {event_name} is the input at fault.

Solutions

  1. Fix the runtime event producer to always attach a thread id (or valid turn id) to code cell events
  2. Skip the affected event/rollout when replaying older traces
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/rollout-trace/src/reducer/code_cell.rs:544 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/95be46dfcaf6563f. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rollout-trace/src/reducer/code_cell.rs:544

    }

    /// Resolves the owning thread for a code-cell runtime event.
    ///
    /// Runtime events should carry a thread id, but older/raw paths may only have
    /// the turn id. The fallback keeps replay strict while avoiding duplicate logic
    /// in every code-cell event arm.
    pub(super) fn code_cell_event_thread_id(
        &self,
        thread_id: Option<String>,
        codex_turn_id: Option<&str>,
        runtime_cell_id: &str,
        event_name: &str,
    ) -> Result<String> {
        if let Some(thread_id) = thread_id {
            return Ok(thread_id);
        }
        let Some(codex_turn_id) = codex_turn_id else {
            bail!("{event_name} {runtime_cell_id} did not include a thread id");
        };
        self.rollout
            .codex_turns
            .get(codex_turn_id)
            .map(|turn| turn.thread_id.clone())
            .with_context(|| {
                format!(
                    "{event_name} {runtime_cell_id} referenced unknown Codex turn {codex_turn_id}"
                )
            })
    }

    /// Derives the stable reduced code-cell id from the model-visible exec call id.
    pub(super) fn reduced_code_cell_id_for_model_visible_call(
        &self,
        model_visible_call_id: &str,
    ) -> CodeCellId {
        // The model-visible `exec` call is the durable source identity. The

View on GitHub (pinned to 339751715c)