{"record":{"id":"54367f6f34b5a5cb","repo":"Morganamilo/paru","slug":"unknown-mode","errorCode":null,"errorMessage":"unknown mode {}","messagePattern":"unknown mode (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config.rs","lineNumber":332,"sourceCode":"}\n\nimpl FromStr for Mode {\n    type Err = Error;\n\n    fn from_str(input: &str) -> Result<Self> {\n        let mode = match input {\n            \"all\" => Mode::all(),\n            \"aur\" => Mode::AUR,\n            \"repo\" => Mode::REPO,\n            \"pkgbuilds\" => Mode::PKGBUILD,\n            _ => {\n                let mut mode = Mode::empty();\n                for c in input.chars() {\n                    match c {\n                        'a' => mode |= Mode::AUR,\n                        'r' => mode |= Mode::REPO,\n                        'p' => mode |= Mode::PKGBUILD,\n                        _ => bail!(tr!(\"unknown mode {}\", input)),\n                    }\n                }\n                mode\n            }\n        };\n        Ok(mode)\n    }\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum YesNoAll {\n    Yes,\n    No,\n    All,\n}\n\nimpl ConfigEnum for YesNoAll {\n    const VALUE_LOOKUP: ConfigEnumValues<Self> =","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/Morganamilo/paru/blob/9ac3578807a87858651e81a02586ceb947686e7c/src/config.rs#L314-L350","documentation":"`Mode::from_str` builds a bitmask mode from a character string; any character other than 'a' (AUR), 'r' (repo), or 'p' (pkgbuild) causes a bail with 'unknown mode {}'. The full input string is reported even though the offending char caused it.","triggerScenarios":"Setting a mode option to a string containing invalid characters, e.g. `Mode = abc` ('b' is invalid), `Mode = aur` (full word instead of initials), or `Mode = arz`.","commonSituations":"Users writing 'aur'/'repo' instead of the single letters a/r/p in paru.conf; typos in the mode string; copying mode values from other tools.","solutions":["Use only the characters a, r, p (e.g. `Mode = arp` for all modes)","Remove the invalid character from the mode string","Check the docs: the mode string is a set of initials, not words"],"exampleFix":"// before\nMode = aur\n// after\nMode = a  // or \"ar\" for aur+repo","handlingStrategy":"validation","validationCode":"function validate_mode(input: string): string | null {\n  return /^[arp]*$/.test(input) ? null : `unknown mode '${input}': only chars a, r, p are allowed`;\n}","typeGuard":"function isValidMode(v: string): v is '' | 'a' | 'r' | 'p' | 'ar' | 'ap' | 'rp' | 'arp' {\n  return /^[arp]*$/.test(v);\n}","tryCatchPattern":"match Mode::from_str(input) {\n    Err(e) if e.to_string().contains(\"unknown mode\") => {\n        eprintln!(\"{} — use initials: a=AUR, r=repo, p=pkgbuild (e.g. Mode = arp)\", e);\n        std::process::exit(1);\n    }\n    Err(e) => return Err(e),\n    Ok(m) => apply(m),\n}","preventionTips":["Remember Mode takes initials (a/r/p), not full words like 'aur'","Sanitize the mode string from environment/config before parsing","Prefer the explicit single-char form in shared configs"],"tags":["config","mode","validation","bitmask"],"backgroundTag":"invalid-enum-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"}