BigPizzaV3/CodexPlusPlus · warning · anyhow::Error
不支持的 Content-Encoding:
Error message
不支持的 Content-Encoding:{encoding} What it means
The request-body decoder only supports a fixed set of Content-Encoding values (gzip, deflate/zstd, identity). If the client sends any other encoding (brotli, compress, unknown tokens), the decoder cannot proceed safely and bails with this message naming the offending encoding value.
Solutions
- Remove or change the Content-Encoding header to one of the supported values (gzip/zstd/identity) on the client side
- Send the request body uncompressed (identity)
- Add a decoder branch for the desired encoding (e.g. brotli) in the launcher if support is needed
Example fix
// before
req.headers.set("Content-Encoding", "br");
// after
req.headers.set("Content-Encoding", "gzip"); // or remove the header Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = ["gzip", "zstd", "identity"];
if (encoding && !SUPPORTED.includes(encoding.toLowerCase())) {
throw new Error(`unsupported Content-Encoding: ${encoding}`);
} Type guard
fn is_supported_encoding(e: &str) -> bool {
["gzip", "zstd", "identity"].iter().any(|s| e.eq_ignore_ascii_case(s))
} Try / catch
match encoding {
Some(e) if !is_supported_encoding(&e) => respond(415, format!("unsupported encoding {e}")),
_ => forward(request).await,
} Prevention
- Restrict client Accept-Encoding/Content-Encoding to supported values
- Test against the launcher with each encoding you plan to send
- Prefer identity for maximum compatibility
- Keep client and launcher encoding support lists in sync
When it happens
Trigger: An HTTP request with a `Content-Encoding` header value not in the supported set, e.g. `br` (brotli), `compress`, or a malformed/typo'd encoding string.
Common situations: Clients with aggressive compression defaults (brotli); corporate proxies adding encodings; version drift where a newer client uses an encoding the launcher does not yet decode.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/ffb64dcaf5734437.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/launcher.rs:1449
fn decode_protocol_proxy_request_body(
body: &[u8],
content_encoding: Option<&str>,
) -> anyhow::Result<String> {
let encoding = content_encoding.unwrap_or_default().trim();
let decoded = if encoding.is_empty() || encoding.eq_ignore_ascii_case("identity") {
body.to_vec()
} else if encoding.eq_ignore_ascii_case("zstd") {
let decoder = zstd::stream::read::Decoder::new(std::io::Cursor::new(body))?;
let mut limited = decoder.take((MAX_HTTP_BODY_BYTES + 1) as u64);
let mut decoded = Vec::new();
limited.read_to_end(&mut decoded)?;
if decoded.len() > MAX_HTTP_BODY_BYTES {
anyhow::bail!("解压后的请求体超过大小限制");
}
decoded
} else {
anyhow::bail!("不支持的 Content-Encoding:{encoding}");
};
String::from_utf8(decoded)
.map_err(|error| anyhow::anyhow!("Responses 请求体不是 UTF-8:{error}"))
}
fn overlay_image_response() -> (String, Vec<u8>, String, &'static str) {
let not_found = || {
(
"404 Not Found".to_string(),
serde_json::to_vec(&serde_json::json!({
"status": "failed",
"message": "图片覆盖层未启用或图片不可用"
}))
.unwrap_or_default(),
"application/json; charset=utf-8".to_string(),
"helper.overlay_image_not_found",
)View on GitHub (pinned to b1ed92e5e4)