{"record":{"id":"4659b72a8578efc4","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-4659b7","errorCode":null,"errorMessage":"分享数据大小或格式无效","messagePattern":"分享数据大小或格式无效","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":137,"sourceCode":"    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    }\n    let cipher = Aes256Gcm::new_from_slice(&key).context(\"创建会话解密器失败\")?;\n    cipher\n        .decrypt(Nonce::from_slice(&iv), ciphertext.as_ref())\n        .map_err(|_| anyhow::anyhow!(\"分享会话解密失败\"))\n}\n\npub fn import_rollout_file(home: &Path, source_path: &Path) -> anyhow::Result<Value> {\n    let bytes = fs::read(source_path)\n        .with_context(|| format!(\"读取会话文件失败：{}\", source_path.display()))?;\n    if bytes.len() > MAX_ROLLOUT_BYTES {\n        bail!(\"会话文件超过导入大小限制\");\n    }\n    let content = String::from_utf8(bytes).context(\"会话文件不是有效的 UTF-8\")?;\n    if let Ok(payload) = serde_json::from_str::<Value>(&content)\n        && payload.get(\"kind\").and_then(Value::as_str) == Some(\"codex-rollout\")\n    {\n        return import_rollout(home, &payload);","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/session_share.rs#L119-L155","documentation":"Thrown by decrypt_shared_payload when the envelope's crypto dimensions are wrong: the base64-decoded key is not 32 bytes, the IV not 12 bytes, or the ciphertext exceeds MAX_ROLLOUT_BYTES + 16 (AES-GCM tag). The offending inputs are the k= key fragment and the iv/ciphertext fields of the share record; this guard runs before the AES-256-GCM cipher is constructed.","triggerScenarios":"Thrown at crates/codex-plus-core/src/session_share.rs:137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["使用未截断的原始分享链接（k= 密钥完整）","重新生成分享链接"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}