rustfs/rustfs · error · SizeTooSmall

Size small: got {got}, want {want}

Error message

Size small: got {got}, want {want}

What it means

Typed error raised when a reader produced fewer bytes than the declared content length (got < want). Fires when the request body ends prematurely relative to Content-Length or the expected object size.

Source

Thrown at crates/rio/src/errors.rs:35

/// SHA256 mismatch error - when content SHA256 does not match what was sent from client
#[derive(Error, Debug, Clone, PartialEq)]
#[error("Bad sha256: Expected {expected_sha256} does not match calculated {calculated_sha256}")]
pub struct Sha256Mismatch {
    pub expected_sha256: String,
    pub calculated_sha256: String,
}

/// Bad digest error - Content-MD5 you specified did not match what we received
#[derive(Error, Debug, Clone, PartialEq)]
#[error("Bad digest: Expected {expected_md5} does not match calculated {calculated_md5}")]
pub struct BadDigest {
    pub expected_md5: String,
    pub calculated_md5: String,
}

/// Size too small error - reader size too small
#[derive(Error, Debug, Clone, PartialEq)]
#[error("Size small: got {got}, want {want}")]
pub struct SizeTooSmall {
    pub want: i64,
    pub got: i64,
}

/// Size too large error - reader size too large
#[derive(Error, Debug, Clone, PartialEq)]
#[error("Size large: got {got}, want {want}")]
pub struct SizeTooLarge {
    pub want: i64,
    pub got: i64,
}

/// Size mismatch error
#[derive(Error, Debug, Clone, PartialEq)]
#[error("Size mismatch: got {got}, want {want}")]
pub struct SizeMismatch {
    pub want: i64,

View on GitHub (pinned to 35af688cd9)

Solutions

  1. Resend with a body matching the declared Content-Length
  2. Fix premature stream termination in the upload path
  3. Retry the request; transient truncation may clear
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/rio/src/errors.rs:35 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rustfs/rustfs@35af688cd9 (2026-08-20). Data as JSON: /api/errors/24553511f5bf0334. Report an issue: GitHub.