openai/codex · error · anyhow::Error
compaction request used thread , but codex turn belongs to
Error message
compaction request {} used thread {}, but codex turn {} belongs to {} What it means
Cross-reference guard in start_compaction_request: the request's thread id exists but the referenced codex turn belongs to a different thread, making ownership inconsistent. Mismatched thread/turn ids on the start event are the inputs at fault.
Solutions
- Correct the thread id or turn id recorded with the compaction request
- Fix the producer emitting inconsistent thread/turn pairs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/rollout-trace/src/reducer/compaction.rs:46 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/c4b97eaf3b8c296f.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rollout-trace/src/reducer/compaction.rs:46
.rollout
.compaction_requests
.contains_key(&started.compaction_request_id)
{
bail!(
"duplicate compaction request start for {}",
started.compaction_request_id
);
}
self.thread_mut(&started.thread_id)?;
let Some(turn) = self.rollout.codex_turns.get(&started.codex_turn_id) else {
bail!(
"compaction request {} referenced unknown codex turn {}",
started.compaction_request_id,
started.codex_turn_id
);
};
if turn.thread_id != started.thread_id {
bail!(
"compaction request {} used thread {}, but codex turn {} belongs to {}",
started.compaction_request_id,
started.thread_id,
started.codex_turn_id,
turn.thread_id
);
}
self.rollout.compaction_requests.insert(
started.compaction_request_id.clone(),
CompactionRequest {
compaction_request_id: started.compaction_request_id,
compaction_id: started.compaction_id,
thread_id: started.thread_id,
codex_turn_id: started.codex_turn_id,
execution: ExecutionWindow {
started_at_unix_ms: wall_time_unix_ms,
started_seq: seq,View on GitHub (pinned to 339751715c)