BigPizzaV3/CodexPlusPlus · error · anyhow::Error
分享数据大小或格式无效
Error message
分享数据大小或格式无效
What it means
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.
Source
Thrown at crates/codex-plus-core/src/session_share.rs:137
if encrypted.get("v").and_then(Value::as_u64) != Some(1) {
bail!("不支持此分享的数据格式");
}
let decode = |field: &str| -> anyhow::Result<Vec<u8>> {
let value = encrypted
.get(field)
.and_then(Value::as_str)
.with_context(|| format!("分享数据缺少 {field}"))?;
base64::engine::general_purpose::URL_SAFE_NO_PAD
.decode(value)
.with_context(|| format!("分享数据 {field} 无效"))
};
let key = base64::engine::general_purpose::URL_SAFE_NO_PAD
.decode(key_value)
.context("分享链接解密密钥无效")?;
let iv = decode("iv")?;
let ciphertext = decode("ciphertext")?;
if key.len() != 32 || iv.len() != 12 || ciphertext.len() > MAX_ROLLOUT_BYTES + 16 {
bail!("分享数据大小或格式无效");
}
let cipher = Aes256Gcm::new_from_slice(&key).context("创建会话解密器失败")?;
cipher
.decrypt(Nonce::from_slice(&iv), ciphertext.as_ref())
.map_err(|_| anyhow::anyhow!("分享会话解密失败"))
}
pub fn import_rollout_file(home: &Path, source_path: &Path) -> anyhow::Result<Value> {
let bytes = fs::read(source_path)
.with_context(|| format!("读取会话文件失败:{}", source_path.display()))?;
if bytes.len() > MAX_ROLLOUT_BYTES {
bail!("会话文件超过导入大小限制");
}
let content = String::from_utf8(bytes).context("会话文件不是有效的 UTF-8")?;
if let Ok(payload) = serde_json::from_str::<Value>(&content)
&& payload.get("kind").and_then(Value::as_str) == Some("codex-rollout")
{
return import_rollout(home, &payload);View on GitHub (pinned to f2074595a2)
Solutions
- 使用未截断的原始分享链接(k= 密钥完整)
- 重新生成分享链接
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/codex-plus-core/src/session_share.rs:137 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/4659b72a8578efc4.
Report an issue: GitHub.