jdx/mise · error

object exceeds the encrypted content size limit

Error message

object exceeds the encrypted content size limit

What it means

`cat_object_bounded` reads a git object from the encrypted-history repository subject to a caller-provided byte limit (typically `agecrypt::MAX_PLAINTEXT_BYTES`). If the object is a transient in-memory blob whose length exceeds that limit, this bail fires before any data is returned. It prevents unbounded memory use when decrypting or inspecting history objects.

Solutions

  1. Remove or shrink the oversized file from the tracked/encrypted set; the size cap is intentional.
  2. If you control the call, pass a larger `limit` deliberately (and accept the memory cost).
  3. Read the object in chunks via a different code path if you must process huge blobs (not supported by this API).
  4. Check the blob size first with `git cat-file -s <oid>` to confirm which object is over the cap.
Defensive patterns

Strategy: validation

Validate before calling

// before reading, check the transient blob size
if bytes.len() as u64 > agecrypt::MAX_PLAINTEXT_BYTES {
    eprintln!("object too large to read bounded");
}

Try / catch

// Rust
match store.cat_object_bounded(&oid, agecrypt::MAX_PLAINTEXT_BYTES) {
    Ok(bytes) => render(bytes),
    Err(e) if e.to_string().contains("size limit") => {
        eprintln!("snapshot blob exceeds encrypted-content cap; exclude the file");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `read`, `envelope`, `encrypt`, or `detect` with an object id whose transient (in-memory) blob is larger than the `limit` argument passed to `cat_object_bounded` (shadow.rs:1042-1049).

Common situations: Trying to display or decrypt a snapshot blob that exceeds the encrypted-content size cap — e.g. a user encrypted a very large file (over the plaintext size limit) before the cap existed, or an automated diff/read over an oversized blob.

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 jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/6911d56dd93b4f93. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/shadow.rs:1048

        if let Some(bytes) = self.transient_blob(oid) {
            return Ok(bytes);
        }
        self.git
            .output(PlumbingCall::new(["cat-file", "blob", oid]))
            .wrap_err_with(|| format!("reading {oid}"))
    }

    pub(crate) fn blob_starts_with(&self, oid: &str, prefix: &[u8]) -> Result<bool> {
        if let Some(bytes) = self.transient_blob(oid) {
            return Ok(bytes.starts_with(prefix));
        }
        self.git.blob_starts_with(oid, prefix)
    }

    pub(crate) fn cat_object_bounded(&self, oid: &str, limit: u64) -> Result<Vec<u8>> {
        if let Some(bytes) = self.transient_blob(oid) {
            if bytes.len() as u64 > limit {
                bail!("object exceeds the encrypted content size limit");
            }
            return Ok(bytes);
        }
        let size: u64 = self
            .output_str(PlumbingCall::new(["cat-file", "-s", oid]))?
            .trim()
            .parse()?;
        if size > limit {
            eyre::bail!("object exceeds the encrypted content size limit");
        }
        self.cat_object(oid)
    }

    pub(crate) fn hash_blob(&self, bytes: &[u8]) -> Result<String> {
        self.output_str(PlumbingCall::new(["hash-object", "-w", "--stdin"]).stdin(bytes))
    }

    /// Compute the normal Git identity without writing an object. Read APIs

View on GitHub (pinned to 533346cc37)