affaan-m/ECC · error
exactly one candidate-keyed health assertion is required
Error message
exactly one candidate-keyed health assertion is required
What it means
from_evidence requires the health map of RecordedEvidence to contain exactly one candidate-keyed health assertion. This error is thrown when the evidence has zero health entries (missing assertion) or more than one (multiple candidates asserted healthy). The recorded evaluator supports only a single promoted candidate's health result.
Solutions
- Ensure evidence.health contains exactly one entry: the candidate id that will be promoted.
- Remove extra health entries for non-promoted candidates before calling from_evidence.
- Run the health check during evidence recording and record its single boolean result.
- Validate the evidence struct (health.len() == 1) before passing it to from_evidence.
Example fix
// before evidence.health.insert(candidate_a.clone(), true); evidence.health.insert(candidate_b.clone(), false); // two entries -> bails let eval = RecordedEvaluator::from_evidence(evidence)?; // after evidence.health.clear(); evidence.health.insert(promoted_candidate_id.clone(), true); assert_eq!(evidence.health.len(), 1); let eval = RecordedEvaluator::from_evidence(evidence)?;
Defensive patterns
Strategy: validation
Validate before calling
if evidence.health.len() != 1 {
return Err("exactly one candidate-keyed health assertion is required");
} Prevention
- Record health only for the single promoted candidate.
- Never merge health maps from multiple evidence runs.
- Assert health.len() == 1 as an invariant when constructing RecordedEvidence.
When it happens
Trigger: Calling RecordedEvaluator::from_evidence with evidence.health being an empty map, or with health entries for two or more distinct candidate ids.
Common situations: Recording evidence without running any health check; merging evidence from multiple candidates into one RecordedEvidence; building the evidence struct by hand and populating health for every candidate instead of only the promoted one.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- health evidence does not match candidate and evaluator
- candidate configuration exceeds 1 MiB
- effect lacks reference evidence
- effect evidence source duration is not bound to its receipt…
- harness health evidence exceeds integrity verification bound
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/81d0399a4f93bc13.
Report an issue: GitHub.
Appendix: source
Thrown at ecc2/src/harness_eval.rs:383
Self {
name: "recorded-v1".into(),
scores,
health_ok,
health_candidate: None,
calls: Vec::new(),
}
}
pub fn from_evidence(evidence: RecordedEvidence) -> Result<Self> {
if evidence.evaluator != "recorded-v1" {
bail!("CLI evidence evaluator must be recorded-v1");
}
let score_count = evidence.scores.values().map(BTreeMap::len).sum::<usize>();
if score_count > 20_000 || evidence.scores.keys().any(|id| id.len() != 64) {
bail!("recorded evidence exceeds bounded score or candidate limits");
}
if evidence.health.len() != 1 {
bail!("exactly one candidate-keyed health assertion is required");
}
let (health_candidate, health_ok) = evidence
.health
.into_iter()
.next()
.context("candidate-keyed health evidence is required")?;
let scores = evidence
.scores
.into_iter()
.flat_map(|(id, values)| {
values
.into_iter()
.map(move |(seed, score)| ((id.clone(), seed), score))
})
.collect();
Ok(Self {
name: evidence.evaluator,
scores,View on GitHub (pinned to 8321021c54)