{"record":{"id":"02a94dd63e32ca00","repo":"rtk-ai/rtk","slug":"filter-file-present-but-not-valid-toml-see-the-e","errorCode":null,"errorMessage":"Filter file present but not valid TOML — see the error above.","messagePattern":"Filter file present but not valid TOML — see the error above\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/trust.rs","lineNumber":309,"sourceCode":"            continue;\n        }\n\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!(","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/trust.rs#L291-L327","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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`"],"exampleFix":"// before (invalid TOML)\nfilters = { grep = true, ripgrep = }\n// after\n[filters]\ngrep = true\nripgrep = true","handlingStrategy":"validation","validationCode":"// validate both candidate files before running rtk trust\nfor f in .rtk/filters.toml ~/.config/rtk/filters.toml; do\n  [ -f \"$f\" ] && ! python3 -c \"import tomllib,sys; tomllib.load(open(sys.argv[1],'rb'))\" \"$f\" 2>/dev/null && echo \"INVALID TOML: $f\"\ndone","typeGuard":null,"tryCatchPattern":"rtk trust --yes || {\n  case \"$?\" in\n    1) echo \"check the TOML parse error printed above and fix filters.toml\" ;;\n    *) exit 1 ;;\n  esac\n}","preventionTips":["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"],"tags":["toml","config","trust","filters"],"backgroundTag":"schema-validation-failed","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"}