zeroclaw-labs/zeroclaw · error · anyhow::Error

plugin archive exceeds maximum size of {MAX_PLUGIN_ZIP_BYTES

Error message

plugin archive exceeds maximum size of {MAX_PLUGIN_ZIP_BYTES} bytes

What it means

The plugin archive's declared Content-Length header exceeds MAX_PLUGIN_ZIP_BYTES, so the download is refused before any body bytes are read. This is the early, header-based cap enforced in download_archive_bytes using the saturating content_length check.

Source

Thrown at src/plugin_registry.rs:116

    Ok(DownloadedPlugin {
        _temp_dir: temp_dir,
        plugin_dir,
        manifest,
    })
}

async fn download_archive_bytes(url: &str) -> Result<Vec<u8>> {
    let mut response = reqwest::get(url)
        .await
        .with_context(|| format!("downloading plugin archive {url}"))?;
    let status = response.status();
    if !status.is_success() {
        bail!("plugin archive returned HTTP {status} for {url}");
    }
    if let Some(len) = response.content_length()
        && len > MAX_PLUGIN_ZIP_BYTES as u64
    {
        bail!("plugin archive exceeds maximum size of {MAX_PLUGIN_ZIP_BYTES} bytes");
    }

    let mut bytes = Vec::new();
    while let Some(chunk) = response
        .chunk()
        .await
        .context("reading plugin archive response body")?
    {
        append_chunk_capped(&mut bytes, &chunk, MAX_PLUGIN_ZIP_BYTES)?;
    }
    Ok(bytes)
}

pub(crate) fn collect_capped_chunks<I>(chunks: I, max_bytes: usize) -> Result<Vec<u8>>
where
    I: IntoIterator<Item = Result<Vec<u8>>>,
{
    let mut bytes = Vec::new();

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Replace the archive with a stripped/minimal build under the limit (remove debug symbols, prune vendored deps)
  2. Check the entry URL — a wrong URL may point at a much larger file than intended
  3. If you control the build, rebuild the plugin zip with release profile and excluded heavy assets
  4. If you maintain the toolchain and genuinely need larger artifacts, raise MAX_PLUGIN_ZIP_BYTES and rebuild — but treat it as a policy decision

Example fix

# before: artifact 900MB with debug symbols
# after
[profile.release]
strip = true
# rebuild zip, republish registry entry with the smaller artifact's url + sha256
Defensive patterns

Strategy: validation

Validate before calling

// Enforce the same header-based cap the downloader applies:
let resp = reqwest::head(url).await?;
if let Some(len) = resp.headers().get(reqwest::header::CONTENT_LENGTH)
        .and_then(|v| v.to_str().ok()).and_then(|s| s.parse::<u64>().ok()) {
    assert!(len <= MAX_PLUGIN_ZIP_BYTES as u64, "archive too large");
}

Try / catch

// On 'plugin archive exceeds maximum size', do not retry — the artifact is
// objectively over policy. Report and republish a smaller artifact.

Prevention

When it happens

Trigger: The registry entry's archive URL serving a file whose Content-Length exceeds the compiled-in MAX_PLUGIN_ZIP_BYTES limit. Fires immediately after response headers arrive, before chunk streaming begins (the streaming backstop is error 1410).

Common situations: Plugin artifact bloated by vendored dependencies or debug symbols; accidentally pointing the entry URL at a full source repo tarball or a debug build; a limit lowered in a downstream fork while reusing upstream registry entries.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/da0511bb8d941a9f. Report an issue: GitHub.