{"record":{"id":"b74a3d8f262961b9","repo":"Morganamilo/paru","slug":"config","errorCode":null,"errorMessage":"{}:{}: {}","messagePattern":"\\{\\}:\\{\\}: \\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config.rs","lineNumber":574,"sourceCode":"        let err = match cb.kind {\n            CallbackKind::Section(section) => {\n                self.section = Some(section.to_string());\n                if !matches!(section, \"options\" | \"bin\" | \"env\")\n                    && self.pkgbuild_repos.repo(section).is_none()\n                {\n                    if matches!(section, \"local\" | \"aur\" | \"pkg\" | \"base\") || section.contains('.')\n                    {\n                        bail!(tr!(\"section can not be called {}\", section));\n                    }\n                    self.pkgbuild_repos.add_repo(section.to_string());\n                }\n                Ok(())\n            }\n            CallbackKind::Directive(_, key, value) => self.parse_directive(key, value),\n        };\n\n        let filename = cb.filename.unwrap_or(\"paru.conf\");\n        err.map_err(|e| anyhow!(\"{}:{}: {}\", filename, cb.line_number, e))\n    }\n}\n\nimpl Config {\n    pub fn new() -> Result<Self> {\n        let cache =\n            dirs::cache_dir().ok_or_else(|| anyhow!(tr!(\"failed to find cache directory\")))?;\n        let cache = cache.join(\"paru\");\n        let config =\n            dirs::config_dir().ok_or_else(|| anyhow!(tr!(\"failed to find config directory\")))?;\n        let config = config.join(\"paru\");\n        let state = dirs::state_dir()\n            .or_else(dirs::cache_dir)\n            .ok_or_else(|| anyhow!(tr!(\"failed to find state directory\")))?;\n        let state = state.join(\"paru\");\n\n        let build_dir = cache.join(\"clone\");\n        let old_old_devel_path = cache.join(\"devel.json\");","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/config.rs#L556-L592","documentation":"This is a wrapper error: when parsing a config file (paru.conf or an Include-ed file) fails, paru attaches the filename and line number of the offending directive/callback to the underlying parse error via anyhow! and map_err. It tells the developer exactly which file and line caused the config parse failure. The original error message is preserved as the source of the anyhow chain.","triggerScenarios":"Any parse_directive / parse call inside config file parsing that returns Err; the error is mapped at src/config.rs:574 into '{filename}:{line_number}: {e}'. Triggered by any malformed key=value line or unknown directive in paru.conf or an included config file.","commonSituations":"Typo in a paru.conf option name (e.g. 'BottomUp' vs 'bottomup'), invalid value for an enum-like option, malformed Include file lines, or editing paru.conf by hand and breaking syntax.","solutions":["Read the error's filename:line part and fix the offending line in that file","Check the option name and value against paru's supported directives (paru.conf man page / PARU_CONF docs)","Restore a known-good paru.conf (e.g. /usr/share/doc/paru/paru.conf example)","Use paru --paruconf <path> to test an alternate config file in isolation"],"exampleFix":"// before (paru.conf)\nBottomUp = maybe\n\n// after (paru.conf)\nBottomUp = true","handlingStrategy":"try-catch","validationCode":"// pre-validate each non-empty, non-comment line of paru.conf has form key = value\nlet bad: Vec<&str> = conf.lines().filter(|l| !l.trim().is_empty() && !l.trim().starts_with('#') && !l.contains('=') && !l.trim().starts_with('[') && !l.starts_with(\"Include\")).collect();\nif !bad.is_empty() { eprintln!(\"malformed lines: {:?}\", bad); }","typeGuard":null,"tryCatchPattern":"match Config::new() {\n    Ok(c) => c,\n    Err(e) => { eprintln!(\"paru config error: {:?}\", e); std::process::exit(1); }\n}","preventionTips":["Copy the shipped example paru.conf and change one option at a time","Check each edited option against the paru.conf man page","Keep a version-controlled copy of paru.conf to diff against"],"tags":["config","parse-error","line-number","paru"],"backgroundTag":"invalid-config-value","analyzedSha":"9ac3578807a87858651e81a02586ceb947686e7c","analyzedAt":"2026-09-12T04:57:59.861Z","contentChangedAt":"2026-09-12T04:57:59.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}