rtk-ai/rtk · warning · anyhow::Error

No custom filters found (.rtk/filters.toml or ~/.config/rtk/

Error message

No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml)

What it means

rtk trust only operates on the two well-known custom-filter paths (.rtk/filters.toml, ~/.config/rtk/filters.toml). If neither exists — or the ones that exist parse cleanly but contain zero active filters — there is nothing to trust and the command exits with this message. Built-in rtk filters never require trust.

Source

Thrown at src/hooks/trust.rs:311

        print_filter_notice(&filter_path, scope, &filters);
        print_risk_summary(&content);

        if !(yes || confirm_enable_at_tty()?) {
            eprintln!("  Not enabled — re-run `rtk trust --yes` to trust non-interactively.");
            continue;
        }
        let hash = crate::hooks::integrity::compute_hash_bytes(&bytes);
        trust_filter_with_hash(&filter_path, &hash)?;
        enabled_any = true;
        eprintln!("  Enabled — revoke with `rtk untrust`.");
    }

    if !found_any {
        if had_error {
            anyhow::bail!("Filter file present but not valid TOML — see the error above.");
        }
        anyhow::bail!("No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml)");
    }
    if !enabled_any {
        if !interactive {
            anyhow::bail!("Custom filters found but none enabled — re-run `rtk trust --yes`.");
        }
        return Ok(());
    }
    println!("Filters will now be applied.");
    Ok(())
}

pub fn print_filter_notice(path: &Path, scope: &str, filters: &[(String, String)]) {
    let yellow = "\x1b[33m";
    let reset = "\x1b[0m";
    eprintln!();
    eprintln!(
        "{yellow}Detected {} custom {scope} scoped toml filter(s) in {} — they rewrite matching command output:{reset}",
        filters.len(),

View on GitHub (pinned to d977e1c316)

Solutions

  1. Create .rtk/filters.toml (project) or ~/.config/rtk/filters.toml (user) with [filters.*] entries
  2. Re-run `rtk trust` from the repo root if the file already exists
  3. If you have no custom filters, treat this exit as expected — there is nothing to do
Defensive patterns

Strategy: validation

Validate before calling

# bash: skip trust entirely when no custom filters exist
[ -f .rtk/filters.toml ] || [ -f "$HOME/.config/rtk/filters.toml" ] \
  || { echo 'no custom filters — nothing to trust'; exit 0; }
rtk trust --yes

Prevention

When it happens

Trigger: Running `rtk trust` before creating any custom filter file, or from a directory where the project-level .rtk/filters.toml is not visible — bail at src/hooks/trust.rs:311.

Common situations: Confusing built-in filters (git/cargo compressors) with custom TOML filters; running trust outside the repo root.

Related errors


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