{"record":{"id":"de191b0bcb543008","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-de191b","errorCode":null,"errorMessage":"不支持此分享的数据格式","messagePattern":"不支持此分享的数据格式","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":120,"sourceCode":"        bail!(\"当前分享内容不是可导入的 Codex rollout 会话\");\n    }\n    import_rollout(home, &payload)\n}\n\nfn validate_share_url(url: &str) -> anyhow::Result<reqwest::Url> {\n    let parsed = reqwest::Url::parse(url.trim()).context(\"分享 URL 格式无效\")?;\n    if parsed.scheme() != \"https\" || !parsed.host_str().is_some_and(|host| SHARE_HOSTS.contains(&host)) {\n        bail!(\"仅支持 Codex++ 分享站点链接\");\n    }\n    if parsed.fragment().is_none() {\n        bail!(\"分享链接缺少解密密钥\");\n    }\n    Ok(parsed)\n}\n\nfn decrypt_shared_payload(encrypted: &Value, key_value: &str) -> anyhow::Result<Vec<u8>> {\n    if encrypted.get(\"v\").and_then(Value::as_u64) != Some(1) {\n        bail!(\"不支持此分享的数据格式\");\n    }\n    let decode = |field: &str| -> anyhow::Result<Vec<u8>> {\n        let value = encrypted\n            .get(field)\n            .and_then(Value::as_str)\n            .with_context(|| format!(\"分享数据缺少 {field}\"))?;\n        base64::engine::general_purpose::URL_SAFE_NO_PAD\n            .decode(value)\n            .with_context(|| format!(\"分享数据 {field} 无效\"))\n    };\n    let key = base64::engine::general_purpose::URL_SAFE_NO_PAD\n        .decode(key_value)\n        .context(\"分享链接解密密钥无效\")?;\n    let iv = decode(\"iv\")?;\n    let ciphertext = decode(\"ciphertext\")?;\n    if key.len() != 32 || iv.len() != 12 || ciphertext.len() > MAX_ROLLOUT_BYTES + 16 {\n        bail!(\"分享数据大小或格式无效\");\n    }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/session_share.rs#L102-L138","documentation":"decrypt_shared_payload checks the encrypted envelope's version field 'v' against supported values and bails otherwise. The share record decrypted (or at least parsed) but was sealed with an envelope format this build does not understand — typically a newer client sharing to an older app.","triggerScenarios":"The encrypted JSON passed to import_shared_session_url has encrypted[\"v\"] not equal to 1 (missing, string, or a future version number).","commonSituations":"Importing shares produced by a newer Codex++ that bumped the envelope version; manually constructed payloads omitting \"v\"; shares from a fork using a different format.","solutions":["Upgrade Codex++ to a version that supports the share format's v field","Re-share the session from a version using envelope v=1","If you control the payload, add/fix \"v\": 1 in the encrypted JSON"],"exampleFix":"// before\n{\"ciphertext\": \"...\", \"iv\": \"...\"} // missing v\n// after\n{\"v\": 1, \"ciphertext\": \"...\", \"iv\": \"...\"}","handlingStrategy":"try-catch","validationCode":"fn envelope_is_v1(encrypted: &serde_json::Value) -> bool {\n    encrypted.get(\"v\").and_then(serde_json::Value::as_u64) == Some(1)\n}","typeGuard":null,"tryCatchPattern":"match import_shared_session_url(home, url) {\n    Ok(session) => load(session),\n    Err(e) if e.to_string().contains(\"数据格式\") => suggest_upgrade_or_reshare(),\n    Err(e) => show_error(e),\n}","preventionTips":["Check the envelope \"v\" field before decrypting","Upgrade the app when shares from newer versions fail","Reject unknown versions with a clear message naming the supported version"],"tags":["encryption","versioning","compatibility"],"backgroundTag":"unsupported-operation","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"}