rtk-ai/rtk · error
Filter file present but not valid TOML — see the error…
Error message
Filter file present but not valid TOML — see the error above.
What it means
run_trust scans .rtk/filters.toml and ~/.config/rtk/filters.toml to enable custom filters. If neither file was found (found_any=false) but a TOML parse error was already reported (had_error=true), the failure was caused by an invalid file rather than absence, so it bails with this message pointing at the previously printed parse error.
Solutions
- Read the parse error printed above this message; it names the offending file and TOML line
- Fix the TOML syntax (validate with `rtk trust` again or a TOML linter/taplo)
- If the file is unrecoverable, move it aside and recreate a minimal `[filters]` table, then rerun `rtk trust --yes`
Example fix
// before (invalid TOML)
filters = { grep = true, ripgrep = }
// after
[filters]
grep = true
ripgrep = true Defensive patterns
Strategy: validation
Validate before calling
// validate both candidate files before running rtk trust for f in .rtk/filters.toml ~/.config/rtk/filters.toml; do [ -f "$f" ] && ! python3 -c "import tomllib,sys; tomllib.load(open(sys.argv[1],'rb'))" "$f" 2>/dev/null && echo "INVALID TOML: $f" done
Try / catch
rtk trust --yes || {
case "$?" in
1) echo "check the TOML parse error printed above and fix filters.toml" ;;
*) exit 1 ;;
esac
} Prevention
- Validate filters.toml with a TOML parser after every hand edit (taplo, prettier-plugin-toml, tomllib)
- Keep TOML syntax; do not paste JSON or YAML into filters.toml
- Distinguish the sibling errors: this one means the file exists but is malformed; 'No custom filters found' means paths are missing
When it happens
Trigger: Running `rtk trust` when at least one filters.toml path exists but fails to parse as TOML (syntax error, wrong types), causing read failure -> had_error=true and found_any=false. Also when one path is missing and the other is malformed.
Common situations: Hand-editing filters.toml and leaving a syntax error (unterminated string, bad table header); using JSON/YAML syntax in a .toml file; a tool writing invalid TOML into ~/.config/rtk/filters.toml.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- No custom filters found (.rtk/filters.toml or…
- 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/02a94dd63e32ca00.
Report an issue: GitHub.
Appendix: source
Thrown at src/hooks/trust.rs:309
continue;
}
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!(View on GitHub (pinned to 0924356b4c)