openai/codex · error · anyhow::Error

terminal operation {operation_id} changed process id from {e

Error message

terminal operation {operation_id} changed process id from {existing} to {process_id}

What it means

Error "terminal operation {operation_id} changed process id from {existing} to {process_id}" thrown in openai/codex.

Source

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

            })
            .transpose()?;

        let (terminal_id, started_at_unix_ms, started_seq) = {
            let Some(operation) = self.rollout.terminal_operations.get_mut(operation_id) else {
                bail!("terminal end referenced unknown operation {operation_id}");
            };
            operation.execution.ended_at_unix_ms = Some(wall_time_unix_ms);
            operation.execution.ended_seq = Some(seq);
            operation.execution.status = status;

            if let Some((raw_payload_id, response)) = response {
                push_unique(&mut operation.raw_payload_ids, &raw_payload_id);
                // If begin and end both report a process id they must name the
                // same terminal. If begin omitted it, the end event completes
                // the session join key for this operation.
                match (&operation.terminal_id, response.terminal_id.as_deref()) {
                    (Some(existing), Some(process_id)) if existing != process_id => {
                        bail!(
                            "terminal operation {operation_id} changed process id from \
                             {existing} to {process_id}"
                        );
                    }
                    (None, Some(process_id)) => {
                        operation.terminal_id = Some(process_id.to_string());
                    }
                    (Some(_), Some(_)) | (Some(_), None) | (None, None) => {}
                }
                operation.result = Some(response.result);
            }

            (
                operation.terminal_id.clone(),
                operation.execution.started_at_unix_ms,
                operation.execution.started_seq,
            )
        };

View on GitHub (pinned to 339751715c)

When it happens

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