openai/codex · error

tool runtime end referenced unknown call

Error message

tool runtime end referenced unknown call {tool_call_id}

What it means

A runtime-end observation referenced a tool_call_id that was never started, so there is no tool call to enrich with the terminal facts.

Solutions

  1. Apply tool call start events before runtime end observations
  2. Drop runtime ends for unknown tool calls
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        if terminal_operation_id.is_some() {
            self.sync_terminal_model_observation(&tool_call_id)?;
        }
        self.start_agent_interaction_from_runtime(&tool_call_id, &runtime_payload)?;
        Ok(())
    }

    /// Records a runtime-end observation for an already started tool call.
    pub(super) fn end_tool_runtime_observation(
        &mut self,
        seq: RawEventSeq,
        wall_time_unix_ms: i64,
        tool_call_id: ToolCallId,
        status: ExecutionStatus,
        runtime_payload: RawPayloadRef,
    ) -> Result<()> {
        let (thread_id, terminal_operation_id) = {
            let Some(tool_call) = self.rollout.tool_calls.get_mut(&tool_call_id) else {
                bail!("tool runtime end referenced unknown call {tool_call_id}");
            };
            push_unique(
                &mut tool_call.raw_runtime_payload_ids,
                &runtime_payload.raw_payload_id,
            );
            (
                tool_call.thread_id.clone(),
                tool_call.terminal_operation_id.clone(),
            )
        };

        if let Some(operation_id) = terminal_operation_id {
            self.end_terminal_operation(
                seq,
                wall_time_unix_ms,
                &thread_id,
                &operation_id,
                status,

View on GitHub (pinned to 339751715c)