openai/codex · error · anyhow::Error

terminal session {terminal_id} belongs to thread {}, not {th

Error message

terminal session {terminal_id} belongs to thread {}, not {thread_id}

What it means

Error "terminal session {terminal_id} belongs to thread {}, not {thread_id}" thrown in openai/codex.

Source

Thrown at codex-rs/rollout-trace/src/reducer/tool/terminal.rs:267

                    execution: ExecutionWindow {
                        started_at_unix_ms,
                        started_seq,
                        // Current raw events do not report a terminal/session
                        // shutdown boundary, so the session remains open even
                        // after individual operations complete.
                        ended_at_unix_ms: None,
                        ended_seq: None,
                        status: ExecutionStatus::Running,
                    },
                },
            );
        }

        let Some(session) = self.rollout.terminal_sessions.get_mut(terminal_id) else {
            bail!("terminal session {terminal_id} disappeared during reduction");
        };
        if session.thread_id != thread_id {
            bail!(
                "terminal session {terminal_id} belongs to thread {}, not {thread_id}",
                session.thread_id
            );
        }
        push_unique(&mut session.operation_ids, operation_id);
        Ok(())
    }

    /// Mirrors model-visible tool items onto the terminal observation view.
    ///
    /// Runtime terminal rows are useful on their own, but the model-visible call
    /// and output item ids let viewers jump between transcript and terminal timelines.
    pub(in crate::reducer) fn sync_terminal_model_observation(
        &mut self,
        tool_call_id: &str,
    ) -> Result<()> {
        let Some(tool_call) = self.rollout.tool_calls.get(tool_call_id) else {
            bail!("tool call {tool_call_id} disappeared during terminal observation linking");

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/rollout-trace/src/reducer/tool/terminal.rs:267 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/48d88e5eb57a557c. Report an issue: GitHub.