BigPizzaV3/CodexPlusPlus · error · anyhow::Error

当前分享内容不是可导入的 Codex rollout 会话

Error message

当前分享内容不是可导入的 Codex rollout 会话

What it means

import_shared_session_url fetched the share record, decrypted it with the key from the URL fragment, parsed the JSON, and found payload.kind != 'codex-rollout'. The link and key were valid, but the content is not a Codex rollout session, so it cannot be imported as one.

Solutions

  1. Re-share the session with the current Codex++ version so the payload has kind:"codex-rollout"
  2. Verify the share link points at a genuine Codex rollout export, not arbitrary JSON
  3. Check for version mismatch between sharer and importer and upgrade
Defensive patterns

Strategy: validation

Validate before calling

fn payload_is_rollout(payload: &serde_json::Value) -> bool {
    payload.get("kind").and_then(serde_json::Value::as_str) == Some("codex-rollout")
}

Type guard

fn as_rollout_payload(v: &serde_json::Value) -> Option<&serde_json::Value> {
    (v.get("kind").and_then(serde_json::Value::as_str) == Some("codex-rollout")).then_some(v)
}

Prevention

When it happens

Trigger: The decrypted shared payload JSON lacks a "kind" field of "codex-rollout" — e.g. the share page exported a different payload type or a hand-crafted/garbled payload was uploaded.

Common situations: Importing a share created by an older or newer Codex++ version with a different payload schema; someone crafting a custom share link with arbitrary JSON; corrupted share content.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/7fc6953621f3ab79. Report an issue: GitHub.

Appendix: source

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

        .context("分享会话不存在、已撤销或已过期")?
        .json::<Value>()
        .await
        .context("分享会话响应格式无效")?;
    let encrypted = record
        .get("encrypted")
        .context("分享会话缺少加密内容")?;
    let key_value = parsed
        .fragment()
        .and_then(|fragment| {
            fragment
                .split('&')
                .find_map(|pair| pair.strip_prefix("k="))
        })
        .context("分享链接缺少解密密钥")?;
    let plaintext = decrypt_shared_payload(encrypted, key_value)?;
    let payload: Value = serde_json::from_slice(&plaintext).context("分享会话内容格式无效")?;
    if payload.get("kind").and_then(Value::as_str) != Some("codex-rollout") {
        bail!("当前分享内容不是可导入的 Codex rollout 会话");
    }
    import_rollout(home, &payload)
}

fn validate_share_url(url: &str) -> anyhow::Result<reqwest::Url> {
    let parsed = reqwest::Url::parse(url.trim()).context("分享 URL 格式无效")?;
    if parsed.scheme() != "https" || !parsed.host_str().is_some_and(|host| SHARE_HOSTS.contains(&host)) {
        bail!("仅支持 Codex++ 分享站点链接");
    }
    if parsed.fragment().is_none() {
        bail!("分享链接缺少解密密钥");
    }
    Ok(parsed)
}

fn decrypt_shared_payload(encrypted: &Value, key_value: &str) -> anyhow::Result<Vec<u8>> {
    if encrypted.get("v").and_then(Value::as_u64) != Some(1) {
        bail!("不支持此分享的数据格式");

View on GitHub (pinned to b1ed92e5e4)