{"record":{"id":"7c1d1154d54c1362","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-7c1d11","errorCode":null,"errorMessage":"会话文件内容不完整","messagePattern":"会话文件内容不完整","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":219,"sourceCode":"pub 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)\n        .unwrap_or_default();\n    let content = payload\n        .get(\"content\")\n        .and_then(Value::as_str)\n        .unwrap_or_default();\n    let title = payload\n        .get(\"title\")\n        .and_then(Value::as_str)\n        .unwrap_or(\"导入的会话\")\n        .trim();\n    if source_id.is_empty() || content.is_empty() {\n        bail!(\"会话文件内容不完整\");\n    }\n    if content.len() > MAX_ROLLOUT_BYTES {\n        bail!(\"会话文件超过导入大小限制\");\n    }\n    let new_id = Uuid::new_v4().to_string();\n    let rewritten = rewrite_rollout(content, source_id, &new_id)?;\n    let now = SystemTime::now()\n        .duration_since(UNIX_EPOCH)\n        .unwrap_or_default()\n        .as_secs();\n    let directory = home.join(\"sessions\").join(\"imported\");\n    fs::create_dir_all(&directory).context(\"创建会话目录失败\")?;\n    let path = directory.join(format!(\"rollout-{now}-{new_id}.jsonl\"));\n    fs::write(&path, rewritten).context(\"写入导入会话失败\")?;\n\n    register_imported_thread(home, &new_id, &path, title, content, now)?;\n\n    let index_path = home.join(\"session_index.jsonl\");","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/session_share.rs#L201-L237","documentation":"Thrown by import_rollout when the payload's session_id or content is empty after extraction. Both are mandatory for rebuilding a session (content is the rollout JSONL body); the offending input is the incomplete import payload, and the guard fires before ID rewriting or database registration begins.","triggerScenarios":"Thrown at crates/codex-plus-core/src/session_share.rs:219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["确保导入 JSON 含非空 session_id 与 content"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}