{"record":{"id":"bcf96d853a57f683","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-bcf96d","errorCode":null,"errorMessage":"会话文件超过分享大小限制","messagePattern":"会话文件超过分享大小限制","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":189,"sourceCode":"        &json!({\n            \"kind\": \"codex-rollout\",\n            \"session_id\": session_id,\n            \"content\": content,\n            \"title\": title,\n        }),\n    )\n}\n\npub fn export_rollout(home: &Path, session_id: &str) -> anyhow::Result<Value> {\n    let session_id = session_id.trim();\n    if session_id.is_empty() {\n        bail!(\"会话 ID 为空\");\n    }\n    let path =\n        find_rollout(home, session_id).ok_or_else(|| anyhow::anyhow!(\"找不到原生会话文件\"))?;\n    let bytes = fs::read(&path).with_context(|| format!(\"读取会话文件失败：{}\", path.display()))?;\n    if bytes.len() > MAX_ROLLOUT_BYTES {\n        bail!(\"会话文件超过分享大小限制\");\n    }\n    let content = String::from_utf8(bytes).context(\"会话文件不是有效的 UTF-8\")?;\n    Ok(json!({\n        \"status\": \"ok\",\n        \"kind\": \"codex-rollout\",\n        \"session_id\": session_id,\n        \"content\": content,\n        \"filename\": path.file_name().and_then(|value| value.to_str()).unwrap_or(\"rollout.jsonl\"),\n    }))\n}\n\npub fn import_rollout(home: &Path, payload: &Value) -> anyhow::Result<Value> {\n    if payload.get(\"kind\").and_then(Value::as_str) != Some(\"codex-rollout\") {\n        bail!(\"不支持的会话文件格式\");\n    }\n    let source_id = payload\n        .get(\"session_id\")\n        .and_then(Value::as_str)","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/session_share.rs#L171-L207","documentation":"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.","triggerScenarios":"export_rollout(home, session_id) finds a rollout whose on-disk bytes exceed MAX_ROLLOUT_BYTES.","commonSituations":"Sharing a very long codex session (weeks of history); the target rollout accumulated many event lines; a limit was configured smaller than existing sessions.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let meta = std::fs::metadata(&rollout_path)?;\nif meta.len() > MAX_ROLLOUT_BYTES {\n    anyhow::bail!(\"会话文件过大，无法分享\");\n}","typeGuard":null,"tryCatchPattern":"match export_rollout(&home, id) {\n    Err(e) if e.to_string().contains(\"分享大小限制\") => eprintln!(\"会话过大，请先归档\"),\n    other => other?,\n}","preventionTips":["分享前检查会话文件大小","长期会话定期归档拆分","对 MAX_ROLLOUT_BYTES 与实际会话体量做容量规划"],"tags":["file-size","export","limit"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}