openai/codex · error · anyhow::Error
empty session file
Error message
empty session file: {} What it means
Guard in extract_metadata_from_rollout: the rollout .jsonl file parsed successfully but contained zero items, so there is no metadata to extract. Indicates a truncated/empty session file at the given path rather than a parse failure.
Solutions
- Check whether the session file was truncated by a crash or manual edit; restore from a backup if available
- Delete the empty rollout file so it is not listed as a resumable session
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/rollout/src/metadata.rs:118 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/6aa6abaf7e0e7f74.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/rollout/src/metadata.rs:118
/// Normal rollouts use `rollout-<timestamp>-<thread-id>.jsonl`, where the thread ID and rollout ID
/// are the same. Threads that have been `reverted` use
/// `rollout-<timestamp>-<thread-id>_<rollout-id>.jsonl`, where this returns the ID after `_`.
///
/// This can differ from [`SessionMeta::id`] when `thread/revert` keeps the thread ID stable while
/// switching to a new immutable rollout file.
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;
}View on GitHub (pinned to 339751715c)