BigPizzaV3/CodexPlusPlus · error · anyhow::Error
会话文件超过分享大小限制
Error message
会话文件超过分享大小限制
What it means
export_rollout caps the size of the rollout file it is willing to read and package for sharing. If the located native session file exceeds MAX_ROLLOUT_BYTES, it bails with this message instead of producing an oversized share payload.
Solutions
- Archive/rotate the session so the rollout file fits under MAX_ROLLOUT_BYTES
- Increase MAX_ROLLOUT_BYTES in session_share.rs to accommodate your largest sessions
- Export a truncated copy of the JSONL manually and share via import_rollout
Defensive patterns
Strategy: validation
Validate before calling
let meta = std::fs::metadata(&rollout_path)?;
if meta.len() > MAX_ROLLOUT_BYTES {
anyhow::bail!("会话文件过大,无法分享");
} Try / catch
match export_rollout(&home, id) {
Err(e) if e.to_string().contains("分享大小限制") => eprintln!("会话过大,请先归档"),
other => other?,
} Prevention
- 分享前检查会话文件大小
- 长期会话定期归档拆分
- 对 MAX_ROLLOUT_BYTES 与实际会话体量做容量规划
When it happens
Trigger: export_rollout(home, session_id) finds a rollout whose on-disk bytes exceed MAX_ROLLOUT_BYTES.
Common situations: Sharing a very long codex session (weeks of history); the target rollout accumulated many event lines; a limit was configured smaller than existing sessions.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/bcf96d853a57f683.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/session_share.rs:189
&json!({
"kind": "codex-rollout",
"session_id": session_id,
"content": content,
"title": title,
}),
)
}
pub fn export_rollout(home: &Path, session_id: &str) -> anyhow::Result<Value> {
let session_id = session_id.trim();
if session_id.is_empty() {
bail!("会话 ID 为空");
}
let path =
find_rollout(home, session_id).ok_or_else(|| anyhow::anyhow!("找不到原生会话文件"))?;
let bytes = fs::read(&path).with_context(|| format!("读取会话文件失败:{}", path.display()))?;
if bytes.len() > MAX_ROLLOUT_BYTES {
bail!("会话文件超过分享大小限制");
}
let content = String::from_utf8(bytes).context("会话文件不是有效的 UTF-8")?;
Ok(json!({
"status": "ok",
"kind": "codex-rollout",
"session_id": session_id,
"content": content,
"filename": path.file_name().and_then(|value| value.to_str()).unwrap_or("rollout.jsonl"),
}))
}
pub fn import_rollout(home: &Path, payload: &Value) -> anyhow::Result<Value> {
if payload.get("kind").and_then(Value::as_str) != Some("codex-rollout") {
bail!("不支持的会话文件格式");
}
let source_id = payload
.get("session_id")
.and_then(Value::as_str)View on GitHub (pinned to b1ed92e5e4)