rtk-ai/rtk · error
rtk find does not support compound predicates or actions (e.
Error message
rtk find does not support compound predicates or actions (e.g. -not, -exec). Use `find` directly.
What it means
RTK's find wrapper deliberately supports only a small subset of native find (-name, -iname, -type, -maxdepth plus RTK's own short syntax). parse_find_args first scans args against UNSUPPORTED_FIND_FLAGS — -not, !, -or, -o, -and, -a, -exec, -execdir, -delete, -print0, -newer, -perm, -size, -mtime/-mmin/-atime/-amin/-ctime/-cmin, -empty, -link, -regex, -iregex — and hard-fails instead of silently mis-executing a predicate it cannot honor.
Source
Thrown at src/cmds/system/find_cmd.rs:89
"-regex", "-iregex",
];
fn has_unsupported_find_flags(args: &[String]) -> bool {
args.iter()
.any(|a| UNSUPPORTED_FIND_FLAGS.contains(&a.as_str()))
}
/// Parse arguments from raw args vec, supporting both native find and RTK syntax.
///
/// Native find syntax: `find . -name "*.rs" -type f -maxdepth 3`
/// RTK syntax: `find *.rs [path] [-m max] [-t type]`
fn parse_find_args(args: &[String]) -> Result<FindArgs> {
if args.is_empty() {
return Ok(FindArgs::default());
}
if has_unsupported_find_flags(args) {
anyhow::bail!(
"rtk find does not support compound predicates or actions (e.g. -not, -exec). Use `find` directly."
);
}
if has_native_find_flags(args) {
parse_native_find_args(args)
} else {
parse_rtk_find_args(args)
}
}
/// Parse native find syntax: `find [path] -name "*.rs" -type f -maxdepth 3`
fn parse_native_find_args(args: &[String]) -> Result<FindArgs> {
let mut parsed = FindArgs::default();
let mut i = 0;
// First non-flag argument is the path (standard find behavior)
if !args[0].starts_with('-') {View on GitHub (pinned to d977e1c316)
Solutions
- Run the real binary directly: `find . -name '*.tmp' -mtime +7 -delete`; if the rtk hook rewrites it, escape with `command find ...`
- Use `rtk proxy find ...` to run native find unfiltered while still tracking usage
- Stay within the supported subset: `rtk find . -name '*.rs' -type f -maxdepth 3`, or RTK syntax `rtk find '*.rs' . -t f -m 20`
Example fix
# before (hook rewrites find -> rtk find; -mtime/-delete are blacklisted) find /tmp -name '*.log' -mtime +7 -delete # rtk: rtk find does not support compound predicates or actions... # after command find /tmp -name '*.log' -mtime +7 -delete # or rtk proxy find /tmp -name '*.log' -mtime +7 -delete
Defensive patterns
Strategy: fallback
Validate before calling
bash: # detect blacklisted flags and bypass rtk before it can fail UNSUPPORTED='-not ! -or -o -and -a -exec -execdir -delete -print0 -newer -perm -size -mtime -mmin -atime -amin -ctime -cmin -empty -link -regex -iregex' for a in "$@"; do case " $UNSUPPORTED " in *" $a "*) exec command find "$@";; esac done rtk find "$@"
Type guard
rust:
const UNSUPPORTED_FIND_FLAGS: &[&str] = &[
"-not", "!", "-or", "-o", "-and", "-a", "-exec", "-execdir", "-delete", "-print0", "-newer",
"-perm", "-size", "-mtime", "-mmin", "-atime", "-amin", "-ctime", "-cmin", "-empty", "-link",
"-regex", "-iregex",
];
fn is_supported_find_args(args: &[String]) -> bool {
args.iter().all(|a| !UNSUPPORTED_FIND_FLAGS.contains(&a.as_str()))
} Try / catch
rust:
match find_cmd::run(&args, verbose) {
Err(e) if e.to_string().contains("compound predicates") => {
// fall back to the real find, unfiltered
let status = std::process::Command::new("find").args(&args).status()?;
std::process::exit(status.code().unwrap_or(1));
}
r => r?,
} Prevention
- Treat rtk find as a fast path for -name/-iname/-type/-maxdepth only
- Default to `command find` or `rtk proxy find` for -exec/-delete/-mtime pipelines
- When hooks rewrite find, remember `command find` escapes the rewrite
- Watch for bare `!` — it is in the blacklist, not just the word -not
When it happens
Trigger: Any `rtk find` (or hook-rewritten `find`) invocation containing a blacklisted token as a standalone argument: `find /tmp -name '*.log' -mtime +7 -delete` (-mtime, -delete), compound predicates with -o/-not, actions like -exec rm {} \; or -print0, or -size/-perm tests.
Common situations: The rtk hook rewrites plain `find` to `rtk find`, so long-standing cleanup one-liners (-mtime +7 -delete, -exec) suddenly fail after installing hooks; agents using -print0 for null-safe xargs pipelines; scripts mixing RTK short syntax with native flags.
Related errors
- Cursor hooks are global-only. Use: rtk init -g --agent curso
- dotnet: no subcommand specified
- gt: no subcommand specified
- go: no subcommand specified
- sbt: no subcommand specified
AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16).
Data as JSON: /api/errors/be3ba4f8b2f5b626.
Report an issue: GitHub.