BigPizzaV3/CodexPlusPlus · error · anyhow::Error
倍率接口返回了无效倍率
Error message
倍率接口返回了无效倍率
What it means
Thrown by validate_sub2api_billing_response when any of the three core multipliers (group, resolved, effective) is non-finite (NaN/inf) or negative. The offending input is the multiplier fields of the billing response; these values flow into cost calculations, so non-physical numbers are rejected rather than clamped.
Source
Thrown at crates/codex-plus-core/src/sub2api.rs:116
return format!("{cleaned}/sub2api/billing");
}
format!("{cleaned}/v1/sub2api/billing")
}
fn validate_sub2api_billing_response(response: &Sub2ApiBillingResponse) -> anyhow::Result<()> {
if response.object != "sub2api.key_billing"
|| response.schema_version != 1
|| response.billing_scope != "token"
{
anyhow::bail!("倍率接口返回结构不是 sub2api.key_billing");
}
for value in [
response.group_rate_multiplier,
response.resolved_rate_multiplier,
response.effective_rate_multiplier,
] {
if !value.is_finite() || value < 0.0 {
anyhow::bail!("倍率接口返回了无效倍率");
}
}
if let Some(value) = response.user_rate_multiplier {
if !value.is_finite() || value < 0.0 {
anyhow::bail!("倍率接口返回了无效用户倍率");
}
}
if response.observed_at.trim().is_empty() {
anyhow::bail!("倍率接口缺少观测时间");
}
Ok(())
}
fn sub2api_error_message(body: &str) -> Option<String> {
let payload: Value = serde_json::from_str(body).ok()?;
for path in [&["error", "message"][..], &["message"][..], &["error"][..]] {
let mut current = &payload;
for key in path {View on GitHub (pinned to f2074595a2)
Solutions
- 联系上游修正 sub2api 计费倍率配置
- 忽略计费展示直到上游修复
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/codex-plus-core/src/sub2api.rs:116 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/1b60e874cb05030c.
Report an issue: GitHub.