BigPizzaV3/CodexPlusPlus · error · anyhow::Error

分享服务不可用

Error message

分享服务不可用

What it means

create_share uploads a session to an external sharing service; if every attempt fails and no specific error message was captured (no body error field and no last_error), it falls back to the generic "分享服务不可用" message. It signals the share backend could not be reached or answered unusably.

Solutions

  1. Check the share service endpoint/URL configured in CodexPlusPlus settings is correct and reachable
  2. Test connectivity to the share host (curl/ping) and check proxy or firewall rules
  3. Retry later if the service is having an outage; inspect its status page
  4. Review the underlying last_error text (e.g. HTTP status line) logged before this fallback

Example fix

// before
create_share(&client, &endpoint, &payload).await?; // fails with generic error
// after
match create_share(&client, &endpoint, &payload).await {
    Ok(share) => println!("shared: {}", share),
    Err(e) if e.to_string().contains("分享服务不可用") => {
        eprintln!("share service unreachable, check endpoint {endpoint}");
    }
    Err(e) => return Err(e),
}
Defensive patterns

Strategy: retry

Validate before calling

let resp = reqwest::get(&health_url).await?;
if !resp.status().is_success() {
    anyhow::bail!("分享服务当前不可用(HTTP {})", resp.status());
}

Try / catch

match create_share(&client, &endpoint, &payload).await {
    Ok(share) => share,
    Err(e) if e.to_string().contains("分享服务不可用") => {
        tokio::time::sleep(Duration::from_secs(5)).await;
        create_share(&client, &endpoint, &payload).await?
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: create_share exhausting its retries with responses lacking a JSON "error" string and no stored last_error — e.g. empty bodies, connection-level failures before any HTTP status is available.

Common situations: Share service is down or under maintenance; network/proxy blocks the endpoint; DNS failure; the service returns an empty 502/503 body; firewall in a corporate environment.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/c8334f67e72f5200. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/share.rs:43

                last_error = Some(error.to_string());
                continue;
            }
        };
        let status = response.status();
        let body = response
            .json::<Value>()
            .await
            .unwrap_or_else(|_| Value::Object(Default::default()));
        if status.is_success() && body.get("id").and_then(Value::as_str).is_some() {
            return Ok(body);
        }
        let message = body
            .get("error")
            .and_then(Value::as_str)
            .unwrap_or_else(|| status.canonical_reason().unwrap_or("分享服务请求失败"));
        last_error = Some(format!("{message}(HTTP {status})"));
    }
    bail!(last_error.unwrap_or_else(|| "分享服务不可用".to_string()))
}

View on GitHub (pinned to b1ed92e5e4)