can1357/oh-my-pi · error · io::Error

owner filters in the in-process fd builtin require numeric u

Error message

owner filters in the in-process fd builtin require numeric uid/gid values

What it means

The in-process fd builtin's owner filter accepts only numeric uid/gid values. When parsing the filter value (after optional '!' negation prefix) as u32 fails, this InvalidInput error explains that owner filters require numeric uid/gid values rather than names like 'root' or 'alice'.

Source

Thrown at crates/pi-builtins/src/fd.rs:1458

		.collect()
}

fn parse_owner_filter(value: &str) -> io::Result<OwnerMatcher> {
	let (user, group) = value.split_once(':').unwrap_or((value, ""));
	Ok(OwnerMatcher { user: parse_owner_side(user)?, group: parse_owner_side(group)? })
}

fn parse_owner_side(value: &str) -> io::Result<Option<OwnerSide>> {
	if value.is_empty() {
		return Ok(None);
	}
	let (exclude, raw) = if let Some(raw) = value.strip_prefix('!') {
		(true, raw)
	} else {
		(false, value)
	};
	let id = raw.parse::<u32>().map_err(|_| {
		io::Error::new(
			io::ErrorKind::InvalidInput,
			"owner filters in the in-process fd builtin require numeric uid/gid values",
		)
	})?;
	Ok(Some(if exclude {
		OwnerSide::Exclude(id)
	} else {
		OwnerSide::Include(id)
	}))
}

fn match_target(path: &Path, base_dir: &Path, full_path: bool) -> String {
	if full_path {
		return normalize_display_path(path);
	}
	path.file_name().map_or_else(
		|| normalize_display_path(path.strip_prefix(base_dir).unwrap_or(path)),
		normalize_os_str,

View on GitHub (pinned to 9690622007)

Solutions

  1. Resolve the username to a numeric uid (e.g. via a getpwuid/getpwnam lookup or `id -u <name>`) before passing the filter
  2. Pass the raw numeric uid/gid string, e.g. '0' for root
  3. Keep the '!' prefix if negation is desired, e.g. '!0' to exclude uid 0

Example fix

// before
let filter = OwnerFilter::parse("root");
// after
let uid = /* resolve via passwd lookup */ 0u32;
let filter = OwnerFilter::parse(&uid.to_string());
Defensive patterns

Strategy: validation

Validate before calling

fn validate_owner_filter(value: &str) -> Result<(), String> {
	let raw = value.strip_prefix('!').unwrap_or(value);
	if raw.parse::<u32>().is_err() {
		return Err(format!("owner filter must be numeric uid/gid, got '{raw}'"));
	}
	Ok(())
}

Try / catch

match builtin_result {
	Err(e) if e.to_string().contains("numeric uid/gid") => eprintln!("resolve user/group names to ids first: {e}"),
	Err(e) => return Err(e),
	Ok(v) => /* ... */,
}

Prevention

When it happens

Trigger: Calling the builtin with an owner filter option set to a username or group name (e.g. 'owner=root' or 'owner=!root') instead of a numeric id such as '0' or '1000'; also empty strings or values containing non-digit characters.

Common situations: Scripts copying the CLI's name-based owner filtering behavior into the SDK/embedded call, where only numeric ids are supported; hard-coded names in config; resolving a user by name without calling libc getpwnam first.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/d1d17461d5125c78. Report an issue: GitHub.