BigPizzaV3/CodexPlusPlus · error

无法从会话文件识别会话 ID

Error message

无法从会话文件识别会话 ID

What it means

import_rollout_file reads a session file, accepts it if it is already a codex-rollout JSON, and otherwise must recover a session ID — first from file content via find_session_id, then from the file name stem. This error fires when neither the content nor the file name yields a usable session ID, so the file cannot be imported as a native session.

Source

Thrown at crates/codex-plus-core/src/session_share.rs:164

    let bytes = fs::read(source_path)
        .with_context(|| format!("读取会话文件失败:{}", source_path.display()))?;
    if bytes.len() > MAX_ROLLOUT_BYTES {
        bail!("会话文件超过导入大小限制");
    }
    let content = String::from_utf8(bytes).context("会话文件不是有效的 UTF-8")?;
    if let Ok(payload) = serde_json::from_str::<Value>(&content)
        && payload.get("kind").and_then(Value::as_str) == Some("codex-rollout")
    {
        return import_rollout(home, &payload);
    }
    let session_id = find_session_id(&content)
        .or_else(|| {
            source_path
                .file_stem()
                .and_then(|value| value.to_str())
                .and_then(find_uuid)
        })
        .ok_or_else(|| anyhow::anyhow!("无法从会话文件识别会话 ID"))?;
    let title = source_path
        .file_stem()
        .and_then(|value| value.to_str())
        .unwrap_or("导入的会话");
    import_rollout(
        home,
        &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() {

View on GitHub (pinned to f2074595a2)

Solutions

  1. Rename the file to its session ID (UUID) so the stem-based fallback works
  2. Verify the file is a genuine Codex session/rollout file
  3. Re-export the session from the source installation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/session_share.rs:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/517c80c92ff5d314. Report an issue: GitHub.