astrid-runtime/astrid · error

runtime tree receipt exceeds

Error message

runtime tree receipt exceeds {MAX_RECEIPT_BYTES} bytes

What it means

The runtime tree receipt file is larger than the compile-time MAX_RECEIPT_BYTES limit, so the kernel refuses to read it. The size cap protects against unbounded memory use and against corrupted or adversarial files placed at the receipt path. It is raised as InvalidData before the file is read.

Solutions

  1. Delete or move aside the oversized file and let the app regenerate the receipt on next admission
  2. Verify what the file actually is (`file`, `head -c`) — it may not be a receipt at all
  3. Restore a correctly-sized receipt from backup
  4. Check for a version mismatch: downgrade/upgrade receipts written by mismatched app versions
Defensive patterns

Strategy: validation

Validate before calling

if let Ok(md) = std::fs::metadata(&receipt_path) {
    if md.len() > MAX_RECEIPT_BYTES {
        std::fs::rename(&receipt_path, receipt_path.with_extension("bak"))?;
    }
}

Try / catch

if msg.contains("exceeds") && msg.contains("bytes") {
    // quarantine the oversized file and let the kernel regenerate
    std::fs::remove_file(&path)?;
    retry_admit()?;
}

Prevention

When it happens

Trigger: `read_receipt` checks `metadata.len() > MAX_RECEIPT_BYTES` on the receipt path (called by `admit_blocking`). Happens when an absurdly large file was put at the receipt path, or corruption appended garbage to a real receipt.

Common situations: A sync/restore tool wrote the wrong file at the receipt path; disk corruption; an experimental build wrote oversized receipts that a released build now rejects.

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 astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/f6ab3b03eb5ab54a. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-kernel/src/runtime_tree_admit.rs:190

}

fn read_receipt(path: &Path) -> io::Result<Option<RuntimeTreeReceipt>> {
    let metadata = match fs::symlink_metadata(path) {
        Ok(metadata) => metadata,
        Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(None),
        Err(error) => return Err(error),
    };
    if !metadata.is_file() {
        return Err(io::Error::new(
            io::ErrorKind::InvalidData,
            format!(
                "runtime tree receipt is not a regular file: {}",
                path.display()
            ),
        ));
    }
    if metadata.len() > MAX_RECEIPT_BYTES {
        return Err(io::Error::new(
            io::ErrorKind::InvalidData,
            format!("runtime tree receipt exceeds {MAX_RECEIPT_BYTES} bytes"),
        ));
    }
    astrid_core::platform_fs::validate_private_file(path)?;
    let bytes = fs::read(path)?;
    serde_json::from_slice(&bytes).map(Some).map_err(|error| {
        io::Error::new(
            io::ErrorKind::InvalidData,
            format!("parse runtime tree receipt: {error}"),
        )
    })
}

fn storage_error(error: impl std::error::Error + Send + Sync + 'static) -> io::Error {
    io::Error::other(error)
}

View on GitHub (pinned to affd8760f4)