sharkdp/fd · error · anyhow::Error

' ' is not a recognized user name

Error message

'{}' is not a recognized user name

What it means

The uid portion of --owner (before the colon) is parsed as a number first; if that fails fd falls back to a system username lookup via nix::unistd::User::from_name. If that lookup returns None the name does not correspond to a real account, so the filter cannot be built (filter/owner.rs:44). A leading '!' is stripped before lookup to support negation.

Solutions

  1. Verify the account exists: `id <name>` or `getent passwd <name>`.
  2. Use the numeric uid instead: `fd --owner 1000`.
  3. Correct the spelling of the username.

Example fix

# before
fd --owner alicia

# after (confirm with id, then use correct name or uid)
id alicia || fd --owner 1000
Defensive patterns

Strategy: validation

Validate before calling

ensure_user() {
  local u="$1"
  if id "$u" >/dev/null 2>&1; then
    fd --owner "$u"
  else
    fd --owner "$(id -u)"  # fall back to numeric uid
  fi
}

Prevention

When it happens

Trigger: Passing `fd --owner nonexistentuser`, `fd --owner alice:` for a typo'd or deleted account, or a username that exists only in a nameservice fd cannot reach (NIS/LDAP unavailable).

Common situations: Typos in usernames; accounts removed between composing and running the command; containers where the passwd database lacks the expected user; running as a UID with no matching name while specifying a name.

Related errors


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

Appendix: source

Thrown at src/filter/owner.rs:44

    /// Returns Ok(None) when string is acceptable but a noop (such as "" or ":")
    pub fn from_string(input: &str) -> Result<Self> {
        let mut it = input.split(':');
        let (fst, snd) = (it.next(), it.next());

        if it.next().is_some() {
            return Err(anyhow!(
                "more than one ':' present in owner string '{}'. See 'fd --help'.",
                input
            ));
        }

        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 {

View on GitHub (pinned to ee20f426dd)