{"record":{"id":"b03f7dbe03511fca","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-b03f7d","errorCode":null,"errorMessage":"找不到原生会话文件","messagePattern":"找不到原生会话文件","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":186,"sourceCode":"        .unwrap_or(\"导入的会话\");\n    import_rollout(\n        home,\n        &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    }","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/session_share.rs#L168-L204","documentation":"export_rollout looks up the native codex rollout file for a given session id under the codex home via find_rollout. If no matching file exists on disk it raises this error. It means the share/export target session is not present in the local codex sessions directory.","triggerScenarios":"Calling export_rollout with a session id that was never created locally; sessions directory moved or cleaned; wrong codex home directory configured; mistyped/foreign session id.","commonSituations":"Trying to share a session from another machine; home directory changed after a codex upgrade; session files deleted by cleanup scripts; using an id from an imported share that was never imported locally.","solutions":["Verify the session id exists under ~/.codex/sessions (or the configured CODEX_HOME) and matches a rollout file.","Point the export call at the correct home directory containing the session.","Re-check the session id for typos; list available sessions and pick the right one.","Restore the rollout file from backup or re-run the session if the file was deleted."],"exampleFix":"// before\nexport_rollout(&wrong_home, \"3f2a1b8c-...\")?;\n// after\nlet home = dirs::home_dir().unwrap().join(\".codex\");\nexport_rollout(&home, \"3f2a1b8c-9d4e-4f01-8a2b-7c6d5e4f3a2b\")?;","handlingStrategy":"try-catch","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction rolloutExists(home, sessionId) {\n  const dir = path.join(home, 'sessions');\n  return findRecursive(dir, f => f.includes(sessionId)).length > 0;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await api.exportRollout(sessionId);\n} catch (e) {\n  if (String(e).includes('找不到原生会话文件')) {\n    alert('本地未找到该会话，请确认会话在本机创建或已恢复备份');\n  } else { throw e; }\n}","preventionTips":["Only share sessions created on the local machine.","Keep CODEX_HOME consistent across app restarts.","Avoid cleanup scripts that delete sessions/*.jsonl.","Validate the session id against the local session list before exporting."],"tags":["session","file-not-found","export"],"backgroundTag":"file-not-found","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"}