astrid-runtime/astrid · warning
stability quantiles select duplicate boundary neighborhoods
Error message
stability quantiles select duplicate boundary neighborhoods
What it means
As `sampled_boundaries` walks quantiles in order, it computes each quantile's boundary index in the interior and requires each to differ from the previous one. Two quantiles resolving to the same index would sample the identical boundary neighborhood twice, yielding redundant measurements, so the function bails instead.
Source
Thrown at crates/astrid-storage-chunker-evidence/src/stability.rs:164
let mut previous_index = None;
for quantile in quantiles_basis_points {
if *quantile == 0 || *quantile >= 10_000 {
bail!("stability quantiles must lie strictly between zero and 10,000");
}
let index = usize::try_from(
u64::try_from(interior.len())?
.checked_mul(u64::from(*quantile))
.and_then(|value| value.checked_div(10_000))
.ok_or_else(|| anyhow::anyhow!("stability quantile overflow"))?,
)?
.min(
interior
.len()
.checked_sub(1)
.expect("the empty interior returned above"),
);
if previous_index == Some(index) {
bail!("stability quantiles select duplicate boundary neighborhoods");
}
previous_index = Some(index);
sampled.push((*quantile, interior[index].end));
}
Ok(sampled)
}
fn collect(candidate: &Candidate, bytes: &[u8]) -> Result<Vec<Chunk>> {
let mut chunks = Vec::new();
let mut offset = 0_usize;
candidate.visit_boundary_chunks(Cursor::new(bytes), |chunk| {
let start = offset;
offset = offset
.checked_add(chunk.len())
.ok_or_else(|| anyhow::anyhow!("chunk offset overflow"))?;
chunks.push(Chunk {
start,
end: offset,View on GitHub (pinned to affd8760f4)
Solutions
- Deduplicate and widen the quantile spacing in the configuration (e.g. 1250, 2500, 5000, 7500).
- Ensure the fixture is large enough that adjacent quantiles map to distinct interior indices.
- Pre-filter quantiles by computed index (drop any whose index equals the previous one) before calling.
- Check the config file for copy-pasted duplicate quantile entries.
Example fix
// before let quantiles: &[u16] = &[5000, 5001, 5002]; // after let quantiles: &[u16] = &[2500, 5000, 7500];
Defensive patterns
Strategy: validation
Validate before calling
fn dedupe_quantile_indices(interior_len: usize, quantiles: &[u16]) -> Vec<u16> {
let mut last: Option<usize> = None;
let mut kept = Vec::new();
for &q in quantiles {
let idx = interior_len * q as usize / 10_000;
if last != Some(idx) {
kept.push(q);
last = Some(idx);
}
}
kept
} Try / catch
let quantiles = dedupe_quantile_indices(interior_len, &configured_quantiles);
match measure_fixture(&fixture, &quantiles) {
Err(e) if e.to_string().contains("duplicate boundary neighborhoods") => {
eprintln!("quantiles too dense for this fixture; widen spacing");
},
r => r?,
} Prevention
- Deduplicate quantiles and pre-compute their interior indices before measuring.
- Scale quantile spacing with fixture size (fewer quantiles for small fixtures).
- Sort and dedupe configured quantile lists at load time.
When it happens
Trigger: Calling `measure_fixture` with quantiles that are close enough (or on a small interior) that floor(interior_len * q / 10000) repeats — e.g. quantiles [5000, 5001] on a very short interior, or duplicate quantile values in the list.
Common situations: Fine-grained quantile sets applied to small fixtures; duplicated entries in a quantile config; quantiles listed out of order after sorting dedupe was skipped.
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
- stability quantiles must lie strictly between zero and 10,00
- stability fixture has no interior boundary
- durable capsule {} has malformed contracts pin
- refusing to seed canonical from a non-content-address contra
- invalid value for {capsule_id}.{key}: expected one of {}, go
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/8d2eecb387914550.
Report an issue: GitHub.