astrid-runtime/astrid · error
group '{group_name}' has no capsules
Error message
group '{group_name}' has no capsules What it means
In headless (non-interactive) capsule selection, after filtering a group's capsules for `default: true`, the code needs a fallback first capsule. If the group contains no capsules at all, both defaults and the first-item fallback are unavailable, so this error is thrown naming the empty group.
Source
Thrown at crates/astrid-cli/src/commands/init.rs:431
// fallback; iterate groups in sorted order for stable warnings.
let mut groups: HashMap<String, Vec<DistroCapsule>> = HashMap::new();
for cap in capsules {
match &cap.group {
None => selected.push(cap),
Some(group) => groups.entry(group.clone()).or_default().push(cap),
}
}
let mut group_names: Vec<String> = groups.keys().cloned().collect();
group_names.sort_unstable();
for group_name in group_names {
let group_caps = groups.remove(&group_name).unwrap_or_default();
let defaults: Vec<DistroCapsule> =
group_caps.iter().filter(|c| c.default).cloned().collect();
if defaults.is_empty() {
let first = group_caps
.first()
.ok_or_else(|| anyhow::anyhow!("group '{group_name}' has no capsules"))?;
eprintln!(
"{}",
Theme::warning(&format!(
"group '{group_name}' has no default capsule — selecting first: {}",
first.name
))
);
selected.push(first.clone());
} else {
selected.extend(defaults);
}
}
Ok(selected)
}
/// Prompt for distro-level variables needed by the selected capsules.
/// Only prompts for variables that are actually referenced by a selected capsule's env.View on GitHub (pinned to affd8760f4)
Solutions
- Check the group name spelling against the available groups listed by init
- Update the group name to one that exists in the current distribution manifest
- If authoring the manifest, add capsules to the group
- Make the error list valid group names to speed up diagnosis
Example fix
// before
.ok_or_else(|| anyhow::anyhow!("group '{group_name}' has no capsules"))?;
// after
.ok_or_else(|| anyhow::anyhow!(
"group '{group_name}' has no capsules (known groups: {}) — check --group spelling",
groups.keys().cloned().collect::<Vec<_>>().join(", ")
))?; Defensive patterns
Strategy: validation
Validate before calling
// preflight: confirm the group exists and is non-empty before headless init
let group_ok = manifest.groups.iter()
.any(|g| g.name == requested_group && !g.capsules.is_empty());
if !group_ok {
bail!("group '{}' missing or empty; available: {:?}", requested_group,
manifest.groups.iter().map(|g| &g.name).collect::<Vec<_>>());
} Try / catch
match select_capsules(&groups, &group_name, /*headless=*/ true) {
Err(e) if e.to_string().contains("has no capsules") => {
eprintln!("{e}; falling back to default group");
select_capsules(&groups, DEFAULT_GROUP, true)?
}
other => other?,
} Prevention
- Verify group names against the current manifest before headless runs
- Keep at least one capsule per group in the distribution manifest
- Avoid unwrap_or_default when looking up group buckets — surface unknown group names
- Pin CI to explicit, tested group names
When it happens
Trigger: Running `astrid init` in headless mode (e.g. in CI) where the requested --group names a group with zero capsules in the distribution manifest, or where group name resolution produced an empty bucket.
Common situations: Typo in the group name (a group key doesn't exist, so remove(&group_name).unwrap_or_default() silently yields an empty vec); distribution manifest updated and the group was removed or renamed; CI scripts pinned to stale group names.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- unexpected response from kernel: {other:?}
- Installation incomplete: {succeeded}/{total} capsule(s) inst
- all {total} capsule install(s) failed — not writing Distro.l
- capsules are installed, but granting capsule access failed:
- headless::AUTO_APPROVE_UNSUPPORTED_MESSAGE
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/4d5dc190e017a982.
Report an issue: GitHub.