BigPizzaV3/CodexPlusPlus · error · anyhow::Error
会话文件内容不完整
Error message
会话文件内容不完整
What it means
import_rollout requires both a non-empty source session_id and non-empty rollout content; if either is missing the shared file is deemed incomplete and rejected. This guards against writing a corrupted/empty session into the Codex home.
Solutions
- Re-export the session with export_rollout to obtain a complete payload
- Verify the share URL/file was not truncated (check content length) before importing
- Include a non-empty session_id when constructing the payload manually
Example fix
// before
let payload = json!({ "kind": "codex-rollout", "session_id": "", "content": data });
// after
if source_id.is_empty() || content.is_empty() {
anyhow::bail!("分享内容缺失 session_id 或 content");
}
let payload = json!({ "kind": "codex-rollout", "session_id": source_id, "content": content }); Defensive patterns
Strategy: validation
Validate before calling
if payload.get("session_id").and_then(|v| v.as_str()).unwrap_or("").trim().is_empty()
|| payload.get("content").and_then(|v| v.as_str()).unwrap_or("").is_empty()
{
anyhow::bail!("分享内容不完整");
} Type guard
fn is_complete_payload(v: &serde_json::Value) -> bool {
!v.get("session_id").and_then(serde_json::Value::as_str).unwrap_or("").trim().is_empty()
&& !v.get("content").and_then(serde_json::Value::as_str).unwrap_or("").is_empty()
} Prevention
- 传输前对 payload 做完整性校验(如长度/校验和)
- 避免复制粘贴截断,使用文件或 URL 传递
- 导入前打印 payload 键做快速体检
When it happens
Trigger: import_rollout(payload) where payload.session_id is empty/absent or the content string is empty; also reachable via import_shared_session_url / import_rollout_file for such payloads.
Common situations: Truncated share payload (content stripped during copy/paste); exported file whose content field was lost in transit; payload built manually without session_id.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/7c1d1154d54c1362.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/session_share.rs:219
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)
.unwrap_or_default();
let content = payload
.get("content")
.and_then(Value::as_str)
.unwrap_or_default();
let title = payload
.get("title")
.and_then(Value::as_str)
.unwrap_or("导入的会话")
.trim();
if source_id.is_empty() || content.is_empty() {
bail!("会话文件内容不完整");
}
if content.len() > MAX_ROLLOUT_BYTES {
bail!("会话文件超过导入大小限制");
}
let new_id = Uuid::new_v4().to_string();
let rewritten = rewrite_rollout(content, source_id, &new_id)?;
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_secs();
let directory = home.join("sessions").join("imported");
fs::create_dir_all(&directory).context("创建会话目录失败")?;
let path = directory.join(format!("rollout-{now}-{new_id}.jsonl"));
fs::write(&path, rewritten).context("写入导入会话失败")?;
register_imported_thread(home, &new_id, &path, title, content, now)?;
let index_path = home.join("session_index.jsonl");View on GitHub (pinned to b1ed92e5e4)