openai/codex · error · anyhow::Error

code cell end referenced unknown cell

Error message

code cell end referenced unknown cell {code_cell_id}

What it means

Consistency guard in end_or_queue_code_cell: a code cell end event references a cell id that is neither reduced nor pending, so there is nothing to finish. Indicates the matching start event was never observed in the rollout stream.

Solutions

  1. Inspect the rollout for a missing/dropped code cell start event
  2. Regenerate the trace from an intact rollout
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        &mut self,
        seq: RawEventSeq,
        wall_time_unix_ms: i64,
        code_cell_id: CodeCellId,
        status: CodeCellRuntimeStatus,
    ) -> Result<()> {
        if !self.rollout.code_cells.contains_key(&code_cell_id) {
            if self.pending_code_cell_starts.contains_key(&code_cell_id) {
                self.queue_code_cell_lifecycle_event(
                    code_cell_id,
                    PendingCodeCellLifecycleEvent {
                        seq,
                        wall_time_unix_ms,
                        kind: PendingCodeCellLifecycleEventKind::Ended { status },
                    },
                );
                return Ok(());
            }
            bail!("code cell end referenced unknown cell {code_cell_id}");
        }
        self.end_code_cell(seq, wall_time_unix_ms, code_cell_id, status)
    }

    fn end_code_cell(
        &mut self,
        seq: RawEventSeq,
        wall_time_unix_ms: i64,
        code_cell_id: CodeCellId,
        status: CodeCellRuntimeStatus,
    ) -> Result<()> {
        let Some(cell) = self.rollout.code_cells.get_mut(&code_cell_id) else {
            bail!("code cell end referenced unknown cell {code_cell_id}");
        };

        if cell.initial_response_at_unix_ms.is_none() {
            cell.initial_response_at_unix_ms = Some(wall_time_unix_ms);
            cell.initial_response_seq = Some(seq);

View on GitHub (pinned to 339751715c)