rtk-ai/rtk · error
No custom filters found (.rtk/filters.toml or…
Error message
No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml)
What it means
`rtk trust` scans the gated filter locations (.rtk/filters.toml in the project and ~/.config/rtk/filters.toml globally) for custom TOML filters to trust. If none of those files exist, or the ones that exist contain no active filters (and no parse errors), run_trust has nothing to trust and bails with this message. It is a guard telling you there is no custom filter content at all — the trust workflow is a no-op.
Solutions
- Create the filter file first: add filters to .rtk/filters.toml (project scope) or ~/.config/rtk/filters.toml (global scope), then re-run `rtk trust`.
- Verify you are in the project root (or a directory whose .rtk/filters.toml resolves) — the file is looked up relative to where the command runs.
- Check the file actually contains active filter entries under the expected TOML section; an empty or comment-only file yields no filters.
- If custom filters are not needed at all, simply do not run `rtk trust` — built-in filters work without trusting.
Example fix
// before: run with no filter file $ rtk trust Error: No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml) // after: create .rtk/filters.toml with an active filter, then trust $ cat > .rtk/filters.toml <<'EOF' [filters.my-filter] pattern = "warning: .*" EOF $ rtk trust --yes
Defensive patterns
Strategy: validation
Validate before calling
import os, pathlib
def can_run_trust():
candidates = [
pathlib.Path(".rtk/filters.toml"),
pathlib.Path.home() / ".config/rtk/filters.toml",
]
for p in candidates:
if p.exists() and p.read_text().strip():
return True
return False
if not can_run_trust():
raise SystemExit("skip `rtk trust`: no filter files with content") Type guard
def has_filters_toml(root):
return (root / ".rtk/filters.toml").is_file() or ((root.home() if hasattr(root, 'home') else __import__('pathlib').Path.home()) / ".config/rtk/filters.toml").is_file() Try / catch
import subprocess
r = subprocess.run(["rtk", "trust"], capture_output=True, text=True)
if r.returncode != 0 and "No custom filters found" in r.stderr:
print("No custom filters configured — nothing to trust; continuing.")
elif r.returncode != 0:
raise RuntimeError(r.stderr) Prevention
- Before running `rtk trust`, check that .rtk/filters.toml or ~/.config/rtk/filters.toml exists and is non-empty.
- Keep filter files in the two supported locations only; avoid custom paths.
- After editing filters.toml, confirm it still contains active (enabled) filter entries.
- Run `rtk trust` from the project root so the project-scoped path resolves.
When it happens
Trigger: Running `rtk trust` (or `rtk trust --yes`) when neither .rtk/filters.toml nor ~/.config/rtk/filters.toml exists, or when the files exist but `active_filter_summaries` returns an empty list (e.g. an empty [filters] section or only disabled entries) and no parse error was recorded.
Common situations: Running `rtk trust` in a repo that has no project-local filters.toml yet; assuming filters live at a different path than the two supported ones; a filters.toml whose filter entries were all removed or disabled, leaving an empty file; typos in the path (e.g. .rtk/filter.toml singular).
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- Filter file present but not valid TOML — see the error…
- config.toml is not valid TOML
- Custom filters found but none enabled — re-run `rtk trust…
- filter(s) have no inline tests (use --require-all in CI)
- — invalid TOML, not loaded
AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19).
Data as JSON: /api/errors/d46d8cfef53f866f.
Report an issue: GitHub.
Appendix: 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 0924356b4c)