{"record":{"id":"d46d8cfef53f866f","repo":"rtk-ai/rtk","slug":"no-custom-filters-found-rtk-filters-toml-or-c","errorCode":null,"errorMessage":"No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml)","messagePattern":"No custom filters found \\(\\.rtk/filters\\.toml or ~/\\.config/rtk/filters\\.toml\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/trust.rs","lineNumber":311,"sourceCode":"\n        print_filter_notice(&filter_path, scope, &filters);\n        print_risk_summary(&content);\n\n        if !(yes || confirm_enable_at_tty()?) {\n            eprintln!(\"  Not enabled — re-run `rtk trust --yes` to trust non-interactively.\");\n            continue;\n        }\n        let hash = crate::hooks::integrity::compute_hash_bytes(&bytes);\n        trust_filter_with_hash(&filter_path, &hash)?;\n        enabled_any = true;\n        eprintln!(\"  Enabled — revoke with `rtk untrust`.\");\n    }\n\n    if !found_any {\n        if had_error {\n            anyhow::bail!(\"Filter file present but not valid TOML — see the error above.\");\n        }\n        anyhow::bail!(\"No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml)\");\n    }\n    if !enabled_any {\n        if !interactive {\n            anyhow::bail!(\"Custom filters found but none enabled — re-run `rtk trust --yes`.\");\n        }\n        return Ok(());\n    }\n    println!(\"Filters will now be applied.\");\n    Ok(())\n}\n\npub fn print_filter_notice(path: &Path, scope: &str, filters: &[(String, String)]) {\n    let yellow = \"\\x1b[33m\";\n    let reset = \"\\x1b[0m\";\n    eprintln!();\n    eprintln!(\n        \"{yellow}Detected {} custom {scope} scoped toml filter(s) in {} — they rewrite matching command output:{reset}\",\n        filters.len(),","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/trust.rs#L293-L329","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before: run with no filter file\n$ rtk trust\nError: No custom filters found (.rtk/filters.toml or ~/.config/rtk/filters.toml)\n\n// after: create .rtk/filters.toml with an active filter, then trust\n$ cat > .rtk/filters.toml <<'EOF'\n[filters.my-filter]\npattern = \"warning: .*\"\nEOF\n$ rtk trust --yes","handlingStrategy":"validation","validationCode":"import os, pathlib\n\ndef can_run_trust():\n    candidates = [\n        pathlib.Path(\".rtk/filters.toml\"),\n        pathlib.Path.home() / \".config/rtk/filters.toml\",\n    ]\n    for p in candidates:\n        if p.exists() and p.read_text().strip():\n            return True\n    return False\n\nif not can_run_trust():\n    raise SystemExit(\"skip `rtk trust`: no filter files with content\")","typeGuard":"def has_filters_toml(root):\n    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()","tryCatchPattern":"import subprocess\nr = subprocess.run([\"rtk\", \"trust\"], capture_output=True, text=True)\nif r.returncode != 0 and \"No custom filters found\" in r.stderr:\n    print(\"No custom filters configured — nothing to trust; continuing.\")\nelif r.returncode != 0:\n    raise RuntimeError(r.stderr)","preventionTips":["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."],"tags":["cli","config","filters","toml"],"backgroundTag":"config-file-not-found","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}