quickwit-oss/quickwit · error

max_num_bytes cannot be > 0 if max_num_splits is 0

Error message

max_num_bytes cannot be > 0 if max_num_splits is 0

What it means

SplitStoreQuota::try_new validates quota configuration: allowing a nonzero byte limit while the split count limit is 0 is contradictory (a zero split quota would forbid every split, making the byte quota meaningless), so it bails. The configuration is rejected at construction time rather than silently misbehaving at runtime.

Solutions

  1. Set max_num_splits to a positive value alongside max_num_bytes.
  2. If only a byte quota is wanted, choose a very large max_num_splits instead of 0 (after checking config semantics).
  3. Remove the byte limit if the split store is meant to be disabled.

Example fix

// before
split_store_max_num_splits: 0
split_store_max_num_bytes: 100 GB
// after
split_store_max_num_splits: 1000
split_store_max_num_bytes: 100 GB
Defensive patterns

Strategy: validation

Validate before calling

fn validate_split_store_quota(max_num_splits: usize, max_num_bytes: ByteSize) -> Result<(), String> {
    if max_num_splits == 0 && max_num_bytes.as_u64() > 0 {
        return Err("max_num_bytes set while max_num_splits is 0".into());
    }
    Ok(())
}

Prevention

When it happens

Trigger: Constructing SplitStoreQuota::try_new(max_num_splits=0, max_num_bytes > 0), typically via a split store config where max_num_splits was left at 0/unset but max_num_bytes was set.

Common situations: Index config mistakes: user sets only split_store_max_num_bytes expecting byte-only quota, but 0 splits means disabled/none, not unlimited; template defaults with split count 0.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/762db1e25b9e13ac. Report an issue: GitHub.

Appendix: source

Thrown at quickwit/quickwit-indexing/src/split_store/split_store_quota.rs:45

    /// Maximum size in bytes allowed in the cache. 0 if max_num_splits=0.
    max_num_bytes: ByteSize,
}

impl Default for SplitStoreQuota {
    fn default() -> Self {
        Self {
            num_splits_in_cache: 0,
            size_in_bytes_in_cache: ByteSize::default(),
            max_num_bytes: IndexerConfig::default_split_store_max_num_bytes(),
            max_num_splits: IndexerConfig::default_split_store_max_num_splits(),
        }
    }
}

impl SplitStoreQuota {
    pub fn try_new(max_num_splits: usize, max_num_bytes: ByteSize) -> anyhow::Result<Self> {
        if max_num_splits == 0 && max_num_bytes.as_u64() > 0 {
            anyhow::bail!("max_num_bytes cannot be > 0 if max_num_splits is 0");
        }
        Ok(Self {
            max_num_splits,
            max_num_bytes,
            ..Default::default()
        })
    }

    /// Space quota that prevents any caching.
    pub fn no_caching() -> Self {
        Self::try_new(0, ByteSize::default()).unwrap()
    }

    pub fn can_fit_split(&self, split_size_in_bytes: ByteSize) -> bool {
        if self.num_splits_in_cache >= self.max_num_splits {
            return false;
        }
        if self.size_in_bytes_in_cache.as_u64() + split_size_in_bytes.as_u64()

View on GitHub (pinned to a39730c5cd)