astrid-runtime/astrid · error
duplicate corpus label {:?}
Error message
duplicate corpus label {:?} What it means
`ensure_unique_corpus_labels` inserts each corpus name into a HashSet and bails on the first duplicate. Duplicate labels would collide in reports (and potentially in output filenames), so the library refuses ambiguous configurations.
Source
Thrown at crates/astrid-storage-chunker-evidence/src/main.rs:127
for (name, repository, relative_path) in &options.git_history_specs {
corpora.push(Corpus::version_chain_from_git(
name.clone(),
repository,
relative_path,
)?);
}
if corpora.is_empty() {
bail!("no corpus selected; omit --no-synthetic or pass a corpus or version-chain option");
}
ensure_unique_corpus_labels(&corpora)?;
Ok(corpora)
}
fn ensure_unique_corpus_labels(corpora: &[Corpus]) -> Result<()> {
let mut labels = HashSet::with_capacity(corpora.len());
for corpus in corpora {
if !labels.insert(corpus.name()) {
bail!("duplicate corpus label {:?}", corpus.name());
}
}
Ok(())
}
fn write_report(output: Option<&PathBuf>, report: &EvidenceReport) -> Result<()> {
let mut encoded = serde_json::to_string(report)?;
encoded.push('\n');
if let Some(path) = output {
fs::write(path, encoded)
.with_context(|| format!("write evidence report {}", path.display()))?;
} else {
println!("{encoded}");
}
Ok(())
}
fn parse_options() -> Result<Options> {View on GitHub (pinned to affd8760f4)
Solutions
- Give each corpus a distinct label in its spec (`--git-history samples2=...`)
- Rename one corpus directory or pass an explicit unique name if the tool derives labels from paths
- Before running, list your corpus labels and dedupe them in your script
Example fix
// before bin --git-history samples=repo::a.bin --git-history samples=repo::b.bin // after bin --git-history samples-a=repo::a.bin --git-history samples-b=repo::b.bin
Defensive patterns
Strategy: validation
Validate before calling
fn labels_unique(specs: &[String]) -> bool {
let mut seen = std::collections::HashSet::new();
specs.iter().all(|s| seen.insert(s.split('=').next().unwrap_or("").to_string()))
}
assert!(labels_unique(&git_history_args)); Try / catch
match run_cli(args) {
Err(e) if e.to_string().starts_with("duplicate corpus label") => {
eprintln!("deduping corpus labels and rerunning");
run_cli(&dedupe_labels(&args))
}
other => other,
} Prevention
- Namespace labels in generated scripts (e.g. include an index: samples-1, samples-2)
- Check for duplicates after label sanitization, not just before
- Keep one source of truth for corpus definitions instead of hand-written flag lists
When it happens
Trigger: Passing the same `NAME=` twice (e.g. two `--git-history samples=...` specs, or a `--corpus` whose derived label equals another corpus's label).
Common situations: Copy-pasting a CLI line and forgetting to change the label, two directories normalizing to the same slug after label sanitization, or scripting loops that reuse a fixed name.
Related errors
- no corpus selected; omit --no-synthetic or pass a corpus or
- --git-history requires non-empty NAME=REPO::RELATIVE_PATH
- lifecycle manifest declares environment state but no durable
- --var '{key}' was supplied more than once
- failed to fetch {name} from {url} (HTTP {})
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/427c09b08a3afbf2.
Report an issue: GitHub.