sharkdp/fd · error · anyhow::Error

more than one ':' present in owner string

Error message

more than one ':' present in owner string '{}'. See 'fd --help'.

What it means

OwnerFilter::from_string (filter/owner.rs:32) parses an --owner argument as 'uid:gid' using split(':') and rejects any input that yields a third segment. The owner grammar allows at most one colon separating an optional uid and optional gid; extra colons are unambiguously malformed rather than ambiguous.

Solutions

  1. Use exactly one colon: `fd --owner alice:bob` (uid:gid), or `fd --owner alice` (uid only), or `fd --owner :bob` (gid only).
  2. To negate, prefix a segment with '!': `fd --owner '!alice'`.
  3. Run `fd --help` and read the --owner section for the full grammar.

Example fix

# before
fd --owner alice:bob:carol

# after (single uid:gid pair)
fd --owner alice:bob
Defensive patterns

Strategy: validation

Validate before calling

validate_owner() {
  local v="$1"
  # allow at most one ':'
  case "$v" in
    *:*:*) echo "too many colons"; return 1 ;;
    *) fd --owner "$v" ;;
  esac
}

Prevention

When it happens

Trigger: Passing `fd --owner 3:5:`, `fd --owner ::`, `fd --owner alice:bob:carol`, or any --owner value with two or more ':' characters. The third next() on the split iterator returning Some triggers the error.

Common situations: Attempting to chain multiple owner constraints in one flag (`--owner alice:bob:carol`); copy-paste artifacts with trailing colons; misunderstanding the uid:gid syntax as a list.

Related errors


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

Appendix: source

Thrown at src/filter/owner.rs:32

    NotEq(T),
    Ignore,
}

impl OwnerFilter {
    const IGNORE: Self = OwnerFilter {
        uid: Check::Ignore,
        gid: Check::Ignore,
    };

    /// Parses an owner constraint
    /// Returns an error if the string is invalid
    /// 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 {

View on GitHub (pinned to ee20f426dd)