can1357/oh-my-pi · error
positional paths cannot be combined with --search-path
Error message
positional paths cannot be combined with --search-path
What it means
fd's resolve_search_paths treats --search-path entries and bare positional paths as two mutually exclusive ways to specify where to search. Supplying both is ambiguous, so it returns InvalidInput immediately before doing any work.
Source
Thrown at crates/pi-builtins/src/fd.rs:1145
fn matches_owner_filters(filters: &[OwnerMatcher], _metadata: Option<&Metadata>) -> bool {
filters.is_empty()
}
#[cfg(unix)]
const fn owner_side_matches(side: OwnerSide, actual: u32) -> bool {
match side {
OwnerSide::Include(expected) => actual == expected,
OwnerSide::Exclude(expected) => actual != expected,
}
}
fn resolve_search_paths(
cli: &FdCli,
base_dir: &Path,
host: &Host,
) -> io::Result<Vec<SearchPath>> {
if !cli.search_paths.is_empty() && !cli.paths.is_empty() {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"positional paths cannot be combined with --search-path",
));
}
let raw_paths = if !cli.search_paths.is_empty() {
cli.search_paths.clone()
} else if !cli.paths.is_empty() {
cli.paths.clone()
} else {
vec![PathBuf::from(".")]
};
Ok(raw_paths
.into_iter()
.map(|original| {
let resolved = if original.is_absolute() {
host.resolve(&original)
} else {
host.resolve(base_dir.join(&original))View on GitHub (pinned to 9690622007)
Solutions
- Remove the positional paths and keep everything in --search-path (it accepts multiple values)
- Or drop --search-path and list positional roots instead — positional paths also support multiple values
- In wrappers, pass roots through one parameter only and document the convention
Example fix
// before fd src --search-path tests // after fd --search-path src --search-path tests
Defensive patterns
Strategy: validation
Validate before calling
function validateFdRoots(args) { const hasPos = args.filter(a => !a.startsWith("-")).length > 0; const hasSp = args.some(a => a === "--search-path" || a.startsWith("--search-path=")); if (hasPos && hasSp) throw new Error("fd: use either positional paths or --search-path, not both"); } Type guard
fn search_paths_conflict(cli: &FdCli) -> bool { !cli.search_paths.is_empty() && !cli.paths.is_empty() } Try / catch
if (!cli.search_paths.is_empty() && !cli.paths.is_empty()) { cli.paths = []; /* or merge into search_paths */ } Prevention
- Standardize on one root-specification style across scripts and wrappers
- When wrapping fd, accept roots via a single parameter and forward to exactly one flag
- Document in team tooling that --search-path supersedes positional paths
When it happens
Trigger: `fd pattern dir1 --search-path dir2`, or scripts appending a positional path while a wrapper always injects --search-path.
Common situations: Wrapper functions/aliases that hardcode --search-path while the user also passes a path; copy-pasted commands merging two search-root styles.
Related errors
- --list-details, --exec, and --exec-batch are not supported b
- err.to_string() (invalid glob pattern)
- err.to_string() (invalid regex pattern)
- err.to_string() (invalid exclude glob pattern)
- unknown file type: {value}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/ad67395e5a33f3b3.
Report an issue: GitHub.