sharkdp/fd · error · anyhow::Error
'{}' is not a recognized user name
Error message
'{}' is not a recognized user name What it means
Thrown in src/filter/owner.rs:44 during OwnerFilter::from_string. After the uid token fails to parse as a u32 integer, fd falls back to nix::unistd::User::from_name; if that lookup also returns None (no passwd entry), the name is treated as unrecognized.
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 41532d114e)
Solutions
- Verify the name resolves: 'id <name>' or 'getent passwd <name>'.
- Use the numeric uid instead: 'fd --owner 1000'.
- Fix NSS/passwd resolution (e.g. mount /etc/passwd, configure nsswitch/ldap) and retry.
Example fix
// before fd --owner ghost // after getent passwd ghost || fd --owner 1000
Defensive patterns
Strategy: validation
Validate before calling
# resolve a uid before passing it to fd
resolve_owner() {
case "$1" in
'' | *:*) printf '%s\n' "$1" ;; # already uid or uid:gid form
*)
if ! id "$1" >/dev/null 2>&1; then
echo "unknown user: $1" >&2; return 1
fi
printf '%s\n' "$1"
;;
esac
}
fd --owner "$(resolve_owner "$OWNER")" Type guard
fn uid_resolves(name: &str) -> bool {
name.parse::<u32>().is_ok()
|| nix::unistd::User::from_name(name).ok().flatten().is_some()
} Prevention
- Run 'id <name>' or 'getent passwd <name>' before passing it to --owner.
- Prefer numeric uids in automation to avoid NSS dependency.
- In containers, ensure /etc/passwd is mounted/populated.
When it happens
Trigger: Passing 'fd --owner ghost' where 'ghost' is neither a numeric uid nor a name present in /etc/passwd (or the NSS passwd database).
Common situations: Typos in a username; querying a container that lacks the host's user database; LDAP/NSS user not resolvable in the current namespace; a user that was deleted.
Related errors
- more than one ':' present in owner string '{}'. See 'fd --he
- '{}' is not a recognized group name
- '{}' is not a valid size constraint. See 'fd --help'.
- '{}' is not a valid date or duration. See 'fd --help'.
- The pattern(s) seems to only match files with a leading dot,
AI-assisted analysis of sharkdp/fd@41532d114e (2026-08-06).
Data as JSON: /data/errors/55dc486efd308188.json.
Report an issue: GitHub.