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

Custom filters found but none enabled — re-run `rtk trust --

Error message

Custom filters found but none enabled — re-run `rtk trust --yes`.

What it means

Trust requires explicit consent. When stdin is not a terminal and --yes was not passed, confirm_enable_at_tty cannot prompt, every untrusted filter is skipped ('Not enabled' lines above), and because enabled_any stayed false on a non-interactive run, rtk aborts instead of leaving filters silently unapplied. An interactive run that declines everything simply returns Ok.

Source

Thrown at src/hooks/trust.rs:315

        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(),
        path.display()
    );
    for (name, regex) in filters {
        eprintln!("{yellow}    {name:<20} {regex}{reset}");

View on GitHub (pinned to d977e1c316)

Solutions

  1. Run `rtk trust --yes` in any non-interactive context
  2. Or run plain `rtk trust` from a real terminal and confirm at the prompt
  3. Trust is hash-pinned, so this is one-time per filters.toml version — re-trust after every edit

Example fix

# before (CI job, stdin not a tty)
rtk trust        # bails: none enabled

# after
rtk trust --yes
Defensive patterns

Strategy: validation

Validate before calling

# bash: choose the trust mode by context
if [ -t 0 ]; then rtk trust; else rtk trust --yes; fi

Prevention

When it happens

Trigger: `rtk trust` (no --yes) with piped or closed stdin — CI, cron, scripts — while at least one untrusted filters.toml with active filters exists: bail at src/hooks/trust.rs:315.

Common situations: First trust run inside CI or over an SSH pipe; automation assuming custom filters auto-enable.

Related errors


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