{"record":{"id":"54f6be9512e23a24","repo":"SeleniumHQ/selenium","slug":"invalid-operating-system-os","errorCode":null,"errorMessage":"Invalid operating system: {os}","messagePattern":"Invalid operating system: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"rust/src/config.rs","lineNumber":175,"sourceCode":"            LINUX => vec![\"linux\", \"gnu/linux\"],\n        }\n    }\n\n    pub fn is(&self, os: &str) -> bool {\n        self.to_str_vector()\n            .contains(&os.to_ascii_lowercase().as_str())\n    }\n}\n\npub fn str_to_os(os: &str) -> Result<OS, Error> {\n    if WINDOWS.is(os) {\n        Ok(WINDOWS)\n    } else if MACOS.is(os) {\n        Ok(MACOS)\n    } else if LINUX.is(os) {\n        Ok(LINUX)\n    } else {\n        Err(anyhow!(format!(\"Invalid operating system: {os}\")))\n    }\n}\n\n/// Processor architecture families used by the manager.\n#[allow(dead_code)]\n#[allow(clippy::upper_case_acronyms)]\npub enum ARCH {\n    X32,\n    X64,\n    ARM64,\n    ARMV7,\n}\n\nimpl ARCH {\n    /// Returns the known string aliases for this architecture.\n    pub fn to_str_vector(&self) -> Vec<&str> {\n        match self {\n            ARCH::X32 => vec![ARCH_X86, \"i386\", \"x32\", \"i686\"],","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rust/src/config.rs#L157-L193","documentation":"Returned by str_to_os() in rust/src/config.rs when the supplied OS string does not match any alias of the WINDOWS, MACOS, or LINUX enum variants (windows/win, macos/mac, linux/gnu/linux). It is the canonical mapping failure when Selenium Manager cannot classify the runtime or a user-supplied OS value.","triggerScenarios":"str_to_os() is called with a value like 'freebsd', 'android', 'ios', a typo ('windos'), or a case-mismatched token not normalized by OS::is (which lowercases). Happens when reading SE_OS env var or a config file with an unsupported OS.","commonSituations":"User sets SE_OS to an unsupported value; running on an exotic OS (BSD, Solaris); a config file specifies 'osx' (the macOS aliases are macos/mac, not osx); trailing whitespace in a config value.","solutions":["Set the OS to a supported alias: 'windows', 'macos', 'linux', 'win', 'mac', or 'gnu/linux'.","Leave SE_OS unset so Selenium Manager auto-detects from std::env::consts::OS.","Trim whitespace and check for stray characters in config values.","If on an unsupported OS, run Selenium Manager inside a supported container/VM."],"exampleFix":"# before (env)\nexport SE_OS=osx\n\n# after\nexport SE_OS=macos","handlingStrategy":"validation","validationCode":"// Rust: validate OS string before passing to str_to_os\nfn is_supported_os(os: &str) -> bool {\n    let l = os.to_ascii_lowercase();\n    matches!(l.as_str(), \"windows\" | \"win\" | \"macos\" | \"mac\" | \"linux\" | \"gnu/linux\")\n}\nif !is_supported_os(&os_str) {\n    return Err(anyhow!(\"Use one of: windows, macos, linux\"));\n}","typeGuard":null,"tryCatchPattern":"let os = match str_to_os(&os_str) {\n    Ok(o) => o,\n    Err(e) if e.to_string().contains(\"Invalid operating system\") => {\n        eprintln!(\"Set SE_OS to windows, macos, or linux\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Avoid setting SE_OS manually; let Selenium Manager auto-detect.","Whitelist OS values in config validation.","Trim and lowercase config-sourced OS strings before validation."],"tags":["rust","selenium-manager","config","platform","validation"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}