sharkdp/fd · error · anyhow::Error

'{}' is not a recognized group name

Error message

'{}' is not a recognized group name

What it means

Thrown in src/filter/owner.rs:53 during OwnerFilter::from_string. The gid token failed integer parse, then nix::unistd::Group::from_name returned None, so no group database entry matches the supplied name.

Source

Thrown at src/filter/owner.rs:53

            ));
        }

        let uid = Check::parse(fst, |s| {
            if let Ok(uid) = s.parse() {
                Ok(uid)
            } else {
                User::from_name(s)?
                    .map(|user| user.uid.as_raw())
                    .ok_or_else(|| anyhow!("'{}' is not a recognized user name", s))
            }
        })?;
        let gid = Check::parse(snd, |s| {
            if let Ok(gid) = s.parse() {
                Ok(gid)
            } else {
                Group::from_name(s)?
                    .map(|group| group.gid.as_raw())
                    .ok_or_else(|| anyhow!("'{}' is not a recognized group name", s))
            }
        })?;

        Ok(OwnerFilter { uid, gid })
    }

    /// If self is a no-op (ignore both uid and gid) then return `None`, otherwise wrap in a `Some`
    pub fn filter_ignore(self) -> Option<Self> {
        if self == Self::IGNORE {
            None
        } else {
            Some(self)
        }
    }

    pub fn matches(&self, md: &fs::Metadata) -> bool {
        use std::os::unix::fs::MetadataExt;

View on GitHub (pinned to 41532d114e)

Solutions

  1. Verify the group: 'getent group <name>'.
  2. Use the numeric gid: 'fd --owner :1000'.
  3. Ensure /etc/group (or NSS/ldap) is populated in the runtime, then retry.

Example fix

// before
fd --owner :devs

// after
getent group devs || fd --owner :1000
Defensive patterns

Strategy: validation

Validate before calling

if ! getent group "${GID_PART}" >/dev/null 2>&1 && ! [[ "$GID_PART" =~ ^[0-9]+$ ]]; then
  echo "unknown group: $GID_PART" >&2; exit 1
fi
fd --owner ":$GID_PART"

Type guard

fn gid_resolves(name: &str) -> bool {
    name.parse::<u32>().is_ok()
        || nix::unistd::Group::from_name(name).ok().flatten().is_some()
}

Prevention

When it happens

Trigger: Passing 'fd --owner :ghost' or 'fd --owner alice:ghost' where 'ghost' is not a numeric gid and not present in /etc/group (or the NSS group database).

Common situations: Typo in group name; container missing the host's /etc/group; querying a group that only exists under a different namespace.

Related errors


AI-assisted analysis of sharkdp/fd@41532d114e (2026-08-06). Data as JSON: /data/errors/0451accf6d503f1c.json. Report an issue: GitHub.