BigPizzaV3/CodexPlusPlus · error · anyhow::Error

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

Error message

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

What it means

Thrown by import_shared_session_url after fetching and decrypting the share record: the payload's kind field is not "codex-rollout". The share host may host other content types, but this importer only handles Codex rollout sessions; the offending input is the kind field of the decrypted share payload.

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 f2074595a2)

Solutions

  1. 使用 Codex++ 分享功能生成的会话分享链接
Defensive patterns

Strategy: validation

When it happens

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