openai/codex · error · anyhow::Error

inference completion referenced unknown call

Error message

inference completion referenced unknown call {inference_call_id}

What it means

A terminal inference event (completed/failed/interrupted) referenced an inference_call_id that was never started in this reduction.

Solutions

  1. Ensure start events for inference calls are applied before terminal events
  2. Drop terminal events for unknown calls
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

                    upstream_request_id,
                    partial_response_payload,
                    ..
                } => (
                    inference_call_id,
                    ExecutionStatus::Cancelled,
                    None,
                    upstream_request_id,
                    partial_response_payload,
                ),
                _ => bail!("complete_inference_call received a non-terminal inference event"),
            };

        if !self
            .rollout
            .inference_calls
            .contains_key(&inference_call_id)
        {
            bail!("inference completion referenced unknown call {inference_call_id}");
        }

        let response_item_ids = response_payload
            .as_ref()
            .map(|payload| {
                self.reduce_inference_response(wall_time_unix_ms, &inference_call_id, payload)
            })
            .transpose()?;
        {
            let Some(inference) = self.rollout.inference_calls.get_mut(&inference_call_id) else {
                bail!("inference call {inference_call_id} disappeared during response reduction");
            };
            inference.response_id = response_id;
            // Turn-end cleanup can close a stream before the async mapper observes
            // cancellation. Preserve that terminal status while still retaining any
            // late partial response evidence from the mapper.
            if inference.execution.status == ExecutionStatus::Running {
                inference.execution.ended_at_unix_ms = Some(wall_time_unix_ms);

View on GitHub (pinned to 339751715c)