sharkdp/fd · error · anyhow::Error

' ' is not a recognized group name

Error message

'{}' is not a recognized group name

What it means

The gid portion of --owner (after the colon) is parsed as a number first; on failure fd looks it up via nix::unistd::Group::from_name and errors at filter/owner.rs:53 when no matching group exists. Leading '!' is honored for negation.

Solutions

  1. Confirm the group: `getent group <name>`.
  2. Use the numeric gid: `fd --owner :1000`.
  3. If you meant a user, put it before the colon: `fd --owner alice` (not `:alice`).

Example fix

# before
fd --owner :devs

# after (verify group or use gid)
getent group devs || fd --owner :1000
Defensive patterns

Strategy: validation

Validate before calling

ensure_group() {
  local g="$1"
  if getent group "$g" >/dev/null 2>&1; then
    fd --owner ":$g"
  else
    fd --owner ":$(id -g)"
  fi
}

Prevention

When it happens

Trigger: Passing `fd --owner :nonexistentgroup`, `fd --owner alice:devs` where 'devs' is not a group, or a group name that lives in a nameservice fd cannot query.

Common situations: Typos in group names; groups removed or renamed; containers/distros with different group databases; mistaking a username for a group name.

Related errors


AI-assisted analysis of sharkdp/fd@ee20f426dd (2026-08-09). Data as JSON: /api/errors/0451accf6d503f1c. Report an issue: GitHub.

Appendix: 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 ee20f426dd)