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

seeds must be unique

Error message

seeds must be unique

What it means

evaluate_paired requires all seeds to be distinct, verified by comparing the BTreeSet size to the slice length. Duplicated seeds would bias paired-sample statistics, so they are rejected before evaluation begins.

Source

Thrown at ecc2/src/harness_eval.rs:473

    pub seed: u64,
    pub candidate_score: f64,
    pub baseline_score: f64,
}

pub fn evaluate_paired(
    evaluator: &mut dyn Evaluator,
    candidate_id: &str,
    baseline_id: &str,
    seeds: &[u64],
) -> Result<Vec<PairedSample>> {
    if seeds.is_empty() {
        bail!("at least one explicit seed is required");
    }
    if seeds.len() > 10_000 {
        bail!("seed count exceeds 10000");
    }
    if seeds.iter().copied().collect::<BTreeSet<_>>().len() != seeds.len() {
        bail!("seeds must be unique");
    }
    seeds
        .iter()
        .map(|seed| {
            Ok(PairedSample {
                seed: *seed,
                candidate_score: evaluator.evaluate(candidate_id, *seed)?,
                baseline_score: evaluator.evaluate(baseline_id, *seed)?,
            })
        })
        .collect()
}

#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct PromotionPolicy {
    pub min_samples: usize,
    pub min_mean_delta: f64,
    pub min_win_rate: f64,

View on GitHub (pinned to 06c5e118c4)

Solutions

  1. Deduplicate the seed list before submitting the evaluation.
  2. Check seed generation for collisions (e.g. a broken RNG or repeated literal).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at ecc2/src/harness_eval.rs:473 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/8f9a843ad8379dcf. Report an issue: GitHub.