affaan-m/ECC · error · anyhow::Error

samples cannot be empty

Error message

samples cannot be empty

What it means

PromotionPolicy::compare rejects an empty samples slice after validating the policy itself. A promotion decision cannot be made without paired samples, so an empty result set from evaluation is an error rather than a silent pass.

Source

Thrown at ecc2/src/harness_eval.rs:522

impl PromotionPolicy {
    pub fn validate(self) -> Result<()> {
        if self.min_samples == 0 {
            bail!("minimum samples must be positive");
        }
        if !self.min_mean_delta.is_finite() {
            bail!("minimum mean delta must be finite");
        }
        if !self.min_win_rate.is_finite() || !(0.0..=1.0).contains(&self.min_win_rate) {
            bail!("minimum win rate must be between 0 and 1");
        }
        Ok(())
    }

    pub fn compare(self, samples: &[PairedSample]) -> Result<Comparison> {
        self.validate()?;
        if samples.is_empty() {
            bail!("samples cannot be empty");
        }
        if samples
            .iter()
            .map(|sample| sample.seed)
            .collect::<BTreeSet<_>>()
            .len()
            != samples.len()
        {
            bail!("sample seeds must be unique");
        }
        if samples.iter().any(|s| {
            !s.candidate_score.is_finite()
                || !s.baseline_score.is_finite()
                || !(0.0..=1.0).contains(&s.candidate_score)
                || !(0.0..=1.0).contains(&s.baseline_score)
        }) {
            bail!("scores must be finite and between 0 and 1");
        }

View on GitHub (pinned to 06c5e118c4)

Solutions

  1. Supply at least one sample before requesting the evaluation.
  2. Verify the sampling step ran and did not filter out every sample.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ecc2/src/harness_eval.rs:522 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@06c5e118c4 (2026-08-18). Data as JSON: /api/errors/3611e07fae83796b. Report an issue: GitHub.