openai/codex · error · anyhow::Error

rollout missing metadata builder

Error message

rollout missing metadata builder: {}

What it means

Guard in the rollout metadata extraction path: the session file has items but no usable metadata builder record (the first item is not session meta / the builder line is missing), so extraction cannot proceed. The incomplete rollout file at the given path is the input at fault.

Solutions

  1. Regenerate or repair the rollout file so it starts with a valid SessionMeta record
  2. Ignore/skip the corrupted session file when listing resumable sessions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/rollout/src/metadata.rs:124 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/c27ec3020fa8f3f0. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/rollout/src/metadata.rs:124

pub fn rollout_id_from_path(rollout_path: &Path) -> Option<RolloutId> {
    let file_name = rollout_path.file_name()?.to_str()?;
    Some(RolloutFileName::parse(file_name)?.rollout_id())
}

pub async fn extract_metadata_from_rollout(
    rollout_path: &Path,
    default_provider: &str,
) -> anyhow::Result<ExtractionOutcome> {
    let (items, _thread_id, parse_errors) =
        RolloutRecorder::load_rollout_items(rollout_path).await?;
    if items.is_empty() {
        return Err(anyhow::anyhow!(
            "empty session file: {}",
            rollout_path.display()
        ));
    }
    let builder = builder_from_items(items.as_slice(), rollout_path).ok_or_else(|| {
        anyhow::anyhow!(
            "rollout missing metadata builder: {}",
            rollout_path.display()
        )
    })?;
    let mut metadata = builder.build(default_provider);
    for item in &items {
        apply_rollout_item(&mut metadata, item, default_provider);
    }
    if let Some(updated_at) = file_modified_time_utc(rollout_path).await {
        metadata.updated_at = updated_at;
        metadata.recency_at = updated_at;
    }
    Ok(ExtractionOutcome {
        metadata,
        memory_mode: items.iter().rev().find_map(|item| match item {
            RolloutItem::SessionMeta(meta_line) => meta_line.meta.memory_mode.clone(),
            RolloutItem::ResponseItem(_)
            | RolloutItem::InterAgentCommunication(_)

View on GitHub (pinned to 339751715c)