jdx/mise · error

matching group is present

Error message

matching group is present

What it means

Same pattern as the owner case: within is_some_and(|group| groups.contains(group)), the group Option is guaranteed Some, and expect("matching group is present") documents that. The panic would indicate the invariant was broken by concurrent modification or a refactor.

Solutions

  1. Use a single binding: if let Some(group_name) = group.as_deref().filter(|g| groups.contains(g))
  2. Log before clearing *group = None

Example fix

// before
if group.as_ref().is_some_and(|group| groups.contains(group)) {
    warn!("...", group.as_deref().expect("matching group is present"), ...);
// after
if let Some(group_name) = group.as_deref().filter(|g| groups.contains(g)) {
    warn!("...", group_name, ...);
Defensive patterns

Strategy: type-guard

Validate before calling

let is_ignored = group.as_deref().map(|g| groups.contains(g)).unwrap_or(false);

Type guard

fn ignored_group<'a>(group: &'a Option<String>, groups: &HashSet<String>) -> Option<&'a str> {
    group.as_deref().filter(|g| groups.contains(*g))
}

Prevention

When it happens

Trigger: clear_ignored_principals warns about a Linux-only [bootstrap.groups] entry when the group Option is not Some-and-contained at deref time — only via code restructuring or shared mutable state.

Common situations: Refactors that separate the containment check from the warning log; concurrent mutation of the group field.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/508644c4964af779. Report an issue: GitHub.

Appendix: source

Thrown at src/system/managed_files.rs:341

                "directory",
                request.path.as_path(),
                &mut request.owner,
                &mut request.group,
            )
        }))
    {
        if owner.as_ref().is_some_and(|owner| users.contains(owner)) {
            warn!(
                "ignoring owner '{}' for managed {kind} '{}' because [bootstrap.users] is Linux-only",
                owner.as_deref().expect("matching owner is present"),
                path.display()
            );
            *owner = None;
        }
        if group.as_ref().is_some_and(|group| groups.contains(group)) {
            warn!(
                "ignoring group '{}' for managed {kind} '{}' because [bootstrap.groups] is Linux-only",
                group.as_deref().expect("matching group is present"),
                path.display()
            );
            *group = None;
        }
    }
}

pub(crate) fn inspect_requests(
    files: &mut [ManagedFileRequest],
    directories: &mut [ManagedDirectoryRequest],
) -> Result<()> {
    inspect_paths(files, directories)
}

fn files_from_config(
    config: &Config,
    secrets: &super::secrets::SecretValues,
) -> Result<Vec<ManagedFileRequest>> {

View on GitHub (pinned to 533346cc37)