BigPizzaV3/CodexPlusPlus · error · anyhow::Error

会话文件超过分享大小限制

Error message

会话文件超过分享大小限制

What it means

Thrown by export_rollout after locating and reading the rollout file: its byte length exceeds MAX_ROLLOUT_BYTES (16 MiB), the cap the share pipeline enforces so exported payloads stay transmittable. The offending input is the size of the found session file at the located path.

Source

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

        &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() {
        bail!("会话 ID 为空");
    }
    let path =
        find_rollout(home, session_id).ok_or_else(|| anyhow::anyhow!("找不到原生会话文件"))?;
    let bytes = fs::read(&path).with_context(|| format!("读取会话文件失败:{}", path.display()))?;
    if bytes.len() > MAX_ROLLOUT_BYTES {
        bail!("会话文件超过分享大小限制");
    }
    let content = String::from_utf8(bytes).context("会话文件不是有效的 UTF-8")?;
    Ok(json!({
        "status": "ok",
        "kind": "codex-rollout",
        "session_id": session_id,
        "content": content,
        "filename": path.file_name().and_then(|value| value.to_str()).unwrap_or("rollout.jsonl"),
    }))
}

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)

View on GitHub (pinned to f2074595a2)

Solutions

  1. 先精简会话内容再分享
  2. 改为直接拷贝文件传输
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/session_share.rs:189 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/bcf96d853a57f683. Report an issue: GitHub.