rtk-ai/rtk · error

Unknown filter '{}'. Available: cargo-test, pytest, go-test,

Error message

Unknown filter '{}'. Available: cargo-test, pytest, go-test, go-build, tsc, vitest, grep, rg, find, fd, git-log, git-diff, git-status, log, mypy, ruff-check, ruff-format, prettier, phpunit, pest, paratest, php-test, ecs, phpstan, pint

What it means

`rtk pipe --filter <name>` resolves the name against a fixed registry; unknown names fail with the full supported list (cargo-test, pytest, go-test, go-build, tsc, vitest, grep, rg, find, fd, git-log, git-diff, git-status, log, mypy, ruff-check, ruff-format, prettier, phpunit, pest, paratest, php-test, ecs, phpstan, pint). Omitting --filter lets auto_detect_filter guess from content instead of failing.

Source

Thrown at src/cmds/system/pipe_cmd.rs:264

pub fn run(filter_name: Option<&str>, passthrough: bool) -> Result<()> {
    if passthrough {
        std::io::copy(&mut std::io::stdin(), &mut std::io::stdout())
            .map_err(|e| anyhow::anyhow!("Failed to relay stdin: {}", e))?;
        return Ok(());
    }

    let mut buf = String::new();
    std::io::stdin()
        .take((RAW_CAP + 1) as u64)
        .read_to_string(&mut buf)
        .map_err(|e| anyhow::anyhow!("Failed to read stdin: {}", e))?;
    if buf.len() > RAW_CAP {
        anyhow::bail!("stdin exceeds {} byte limit", RAW_CAP);
    }

    let filter_fn = match filter_name {
        Some(name) => resolve_filter(name).ok_or_else(|| {
            anyhow::anyhow!(
                "Unknown filter '{}'. Available: cargo-test, pytest, go-test, go-build, \
                 tsc, vitest, grep, rg, find, fd, git-log, git-diff, git-status, \
                 log, mypy, ruff-check, ruff-format, prettier, phpunit, pest, \
                 paratest, php-test, ecs, phpstan, pint",
                name
            )
        })?,
        None => auto_detect_filter(&buf),
    };

    let output = apply_filter(filter_fn, &buf);
    let shown = never_worse(&buf, &output);
    print!("{}", shown);
    Ok(())
}

#[cfg(test)]
mod tests {

View on GitHub (pinned to d977e1c316)

Solutions

  1. Drop --filter entirely and let auto-detection pick from the content: `cat out.txt | rtk pipe`
  2. Use an exact kebab-case name from the list — e.g. `--filter vitest` for Vite test output, `--filter tsc` for TypeScript diagnostics
  3. For genuinely unsupported tools, use `rtk pipe --passthrough` or pre-filter with grep

Example fix

# before: jest is not a registered filter
rtk pipe --filter jest < test-out.txt
# Unknown filter 'jest'. Available: cargo-test, pytest, ...

# after
cat test-out.txt | rtk pipe                 # auto-detect (vitest output matches vitest)
cat test-out.txt | rtk pipe --filter vitest  # or name it exactly
Defensive patterns

Strategy: validation

Validate before calling

bash:
KNOWN='cargo-test pytest go-test go-build tsc vitest grep rg find fd git-log git-diff git-status log mypy ruff-check ruff-format prettier phpunit pest paratest php-test ecs phpstan pint'
if [ -n "$FILTER" ] && ! [[ " $KNOWN " =~ " $FILTER " ]]; then
  echo "unknown filter '$FILTER' — omit --filter to auto-detect" >&2
  FILTER=""
fi
rtk pipe ${FILTER:+--filter "$FILTER"} < out.txt

Type guard

rust:
const PIPE_FILTERS: &[&str] = &[
    "cargo-test", "pytest", "go-test", "go-build", "tsc", "vitest", "grep", "rg", "find", "fd",
    "git-log", "git-diff", "git-status", "log", "mypy", "ruff-check", "ruff-format", "prettier",
    "phpunit", "pest", "paratest", "php-test", "ecs", "phpstan", "pint",
];
fn is_known_pipe_filter(name: &str) -> bool {
    PIPE_FILTERS.contains(&name)
}

Try / catch

rust:
match pipe_cmd::run(Some(name), false) {
    Err(e) if e.to_string().contains("Unknown filter") => {
        pipe_cmd::run(None, false) // retry with auto-detect from content
    }
    r => r,
}

Prevention

When it happens

Trigger: Passing any name outside the registry: `rtk pipe --filter jest`, `--filter bun-test`, `--filter cargo-clippy`, `--filter tox`; or a format typo like `--filter cargo_test` / `--filter CargoTest` — keys are exact kebab-case.

Common situations: Assuming every tool rtk wraps as a command proxy also exists as a pipe filter; snake_case habit from other CLIs; stale blog/docs examples; npm users reaching for jest when vitest is the registered key.

Related errors


AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16). Data as JSON: /api/errors/e9833e27b6bc3bcf. Report an issue: GitHub.