astrid-runtime/astrid · error

bottom-k evidence requires at least two versions

Error message

bottom-k evidence requires at least two versions

What it means

The bottom-k sketch measurement requires at least two corpus versions because it computes cross-version scores (delta sizes across configurations). With fewer than two versions there is nothing to compare, so measure bails.

Solutions

  1. Provide a corpus with at least two distinct input versions.
  2. Check the corpus path/configuration includes all intended version files.
  3. Skip the bottom-k measurement for single-version corpora in the caller.

Example fix

// before
sketch::measure(&corpus_of_one_file)?;
// after
if corpus.version_count() >= 2 {
    sketch::measure(&corpus)?;
}
Defensive patterns

Strategy: validation

Validate before calling

let mut n = 0; corpus.visit_inputs(|_| { n += 1; Ok(()) })?; if n < 2 { return Ok(FeatureDisabled); }

Try / catch

match sketch::measure(&corpus) {
    Err(e) if e.to_string().contains("at least two versions") => eprintln!("need >=2 versions for bottom-k"),
    other => other,
}

Prevention

When it happens

Trigger: Calling measure with a corpus that exposes 0 or 1 inputs via visit_inputs — e.g. an empty corpus or a single-version corpus.

Common situations: Testing the library against a single sample file; a directory containing only ignored/empty inputs; misconfigured corpus path pointing at an empty location.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/18188a74324ff707. Report an issue: GitHub.

Appendix: source

Thrown at crates/astrid-storage-chunker-evidence/src/sketch.rs:117

    sketches: &'a [Option<MaterializedSketch>],
    inverted: &'a BTreeMap<[u8; 32], Vec<usize>>,
    sample_size: u16,
}

#[derive(Clone, Debug)]
enum DeltaOperation {
    Copy { offset: u64, length: u64 },
    Add(Vec<u8>),
}

pub fn measure(corpus: &Corpus) -> Result<Vec<SketchEvidenceResult>> {
    let mut versions = Vec::new();
    corpus.visit_inputs(|bytes| {
        versions.push(Version::build(bytes)?);
        Ok(())
    })?;
    if versions.len() < 2 {
        bail!("bottom-k evidence requires at least two versions");
    }

    let mut results = Vec::new();
    for width in SCORE_WIDTHS {
        for sample_size in SAMPLE_SIZES {
            results.push(measure_configuration(
                corpus.name(),
                corpus.kind(),
                &versions,
                *width,
                *sample_size,
            )?);
        }
    }
    Ok(results)
}

fn measure_configuration(

View on GitHub (pinned to affd8760f4)