{"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":"anyhow::Error","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/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/hooks/trust.rs#L291-L327","documentation":"`rtk trust` walks .rtk/filters.toml and ~/.config/rtk/filters.toml and parses each file before trusting it. If a file exists but filter_parse_error reports a TOML syntax error (printed per-file above with the file path and error), the run ends with this summary bail — unparseable filters are never trusted, even with --yes.","triggerScenarios":"A filters.toml with syntax errors (unquoted strings, wrong table headers, stray brackets, bad escapes) when running `rtk trust` or `rtk trust --yes`; had_error is set at src/hooks/trust.rs:271, the bail lands at :309.","commonSituations":"Hand-editing filters with YAML habits; partial writes from an editor crash; filters generated by scripts with unescaped user input.","solutions":["Read the per-file parse error printed above the bail — it names the file and the TOML position","Lint before trusting: `python3 -c 'import tomllib,sys; tomllib.load(open(sys.argv[1],\"rb\"))' .rtk/filters.toml`","Fix the syntax, then re-run `rtk trust --yes`"],"exampleFix":"# .rtk/filters.toml before\n[[filters]]\nname = \"make\"\nmatch_command = ^make\\b    # unquoted regex → TOML error\n\n# after\n[[filters]]\nname = \"make\"\nmatch_command = \"^make\\\\b\"","handlingStrategy":"validation","validationCode":"# bash/CI: validate TOML syntax before running rtk trust\npython3 -c 'import tomllib,sys; tomllib.load(open(sys.argv[1],\"rb\"))' .rtk/filters.toml \\\n  || { echo 'invalid TOML — fix before trust' >&2; exit 1; }\nrtk trust --yes","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint filters.toml in CI with a TOML parser on every commit","Keep custom filters in version control and review diffs before trusting","Quote all string values in filters.toml — unquoted regexes are the most common TOML error"],"tags":["trust","toml","filters","config-parse"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}