Hmbown/CodeWhale · error

Fleet artifact exceeds the 16 MiB limit

Error message

Fleet artifact exceeds the 16 MiB limit

What it means

Fleet artifact publication enforces a 16 MiB ceiling (MAX_ARTIFACT_BYTES) shared with the evidence reader, so the writer can never publish an artifact that read_verified would be unable to verify. write checks the byte length before creating the file and fails closed if exceeded.

Solutions

  1. Truncate or summarize the payload below 16 MiB before calling write (e.g. keep a head/tail slice with an elision marker).
  2. Store oversized content outside the Fleet workspace (object storage, temp file) and write a small reference/metadata artifact instead.
  3. Compress the bytes before publication if the information must be kept.
  4. If 16 MiB is genuinely too small for your workflow, this is a deliberate product limit — raise it in artifacts.rs only together with the verification path.

Example fix

// before
artifacts::write(ws, &path, &huge_bytes)?; // panics-fails over 16 MiB
// after
let trimmed = &huge_bytes[..huge_bytes.len().min(16 * 1024 * 1024 - 1)];
artifacts::write(ws, &path, trimmed)?;
Defensive patterns

Strategy: validation

Validate before calling

const MAX: usize = 16 * 1024 * 1024;
if bytes.len() > MAX {
    bytes = summarize_or_compress(bytes); // keep under ceiling before write
}
artifacts::write(ws, &path, bytes)?;

Prevention

When it happens

Trigger: Calling fleet::artifacts::write(workspace, relative, bytes) with a bytes slice longer than 16 * 1024 * 1024 bytes.

Common situations: Dumping a large log, model output, or binary blob into the Fleet workspace instead of a summarized preview; accumulating outputs that were small in tests but large in production runs.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/45c132187c23cf2a. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/fleet/artifacts.rs:23

#[cfg(test)]
use std::fs::File;
use std::io::{self, Read};
use std::path::Path;

use super::files::WorkspaceFile;
pub(crate) use super::files::path_is_confined;

use anyhow::{Context, Result, ensure};
use codewhale_protocol::fleet::FleetArtifactRef;
use sha2::{Digest, Sha256};

// The HTTP preview stays small; verifying a larger artifact streams its digest
// without retaining all bytes. The writer shares the ceiling so it cannot
// publish an artifact the evidence reader is unable to verify.
const MAX_ARTIFACT_BYTES: u64 = 16 * 1024 * 1024;

pub(crate) fn write(workspace: &Path, relative: &Path, bytes: &[u8]) -> Result<()> {
    ensure!(
        bytes.len() as u64 <= MAX_ARTIFACT_BYTES,
        "Fleet artifact exceeds the 16 MiB limit"
    );
    let parent = WorkspaceFile::open(workspace, relative, true)?;
    match parent.publish(bytes) {
        Ok(()) => Ok(()),
        Err(error) if error.kind() == io::ErrorKind::AlreadyExists => {
            let existing = parent.open_file()?;
            let mut saved = Vec::new();
            existing
                .take(bytes.len() as u64 + 1)
                .read_to_end(&mut saved)?;
            ensure!(
                saved == bytes,
                "An existing Fleet artifact contains different bytes"
            );
            Ok(())
        }

View on GitHub (pinned to 73e0f67d83)