jdx/mise · error

matching owner is present

Error message

matching owner is present

What it means

Inside the is_some_and(|owner| users.contains(owner)) branch, owner is known to be Some and contained, so as_deref().expect("matching owner is present") is an invariant assertion. Panicking means the option was concurrently or logically cleared between the check and the deref — a code-structure violation, not a user input problem.

Solutions

  1. Keep the check-and-deref inside a single if let Some(owner) = owner.as_deref() block filtered by users.contains(owner)
  2. Avoid clearing *owner before logging it

Example fix

// before
if owner.as_ref().is_some_and(|owner| users.contains(owner)) {
    warn!("...", owner.as_deref().expect("matching owner is present"), ...);
// after
if let Some(owner_name) = owner.as_deref().filter(|o| users.contains(o)) {
    warn!("...", owner_name, ...);
Defensive patterns

Strategy: type-guard

Validate before calling

// check principal before warning
let is_ignored = owner.as_deref().map(|o| users.contains(o)).unwrap_or(false);

Type guard

fn ignored_owner<'a>(owner: &'a Option<String>, users: &HashSet<String>) -> Option<&'a str> {
    owner.as_deref().filter(|o| users.contains(*o))
}

Prevention

When it happens

Trigger: Calling clear_ignored_principals (via ignore_non_linux_account_principals) when the owner Option changed between is_some_and and as_deref — only possible through a refactor that alters the check, or misuse of the matched guard.

Common situations: Developers restructuring the warning block and breaking the Some-and-contains pairing; reviewers seeing this panic after such a change.

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/04c60c9bea37a174. Report an issue: GitHub.

Appendix: source

Thrown at src/system/managed_files.rs:333

                "file",
                request.path.as_path(),
                &mut request.owner,
                &mut request.group,
            )
        })
        .chain(directories.iter_mut().map(|request| {
            (
                "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],

View on GitHub (pinned to 533346cc37)