SeleniumHQ/selenium · error · anyhow::Error
Invalid operating system: {os}
Error message
Invalid operating system: {os} What it means
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.
Source
Thrown at rust/src/config.rs:175
LINUX => vec!["linux", "gnu/linux"],
}
}
pub fn is(&self, os: &str) -> bool {
self.to_str_vector()
.contains(&os.to_ascii_lowercase().as_str())
}
}
pub fn str_to_os(os: &str) -> Result<OS, Error> {
if WINDOWS.is(os) {
Ok(WINDOWS)
} else if MACOS.is(os) {
Ok(MACOS)
} else if LINUX.is(os) {
Ok(LINUX)
} else {
Err(anyhow!(format!("Invalid operating system: {os}")))
}
}
/// Processor architecture families used by the manager.
#[allow(dead_code)]
#[allow(clippy::upper_case_acronyms)]
pub enum ARCH {
X32,
X64,
ARM64,
ARMV7,
}
impl ARCH {
/// Returns the known string aliases for this architecture.
pub fn to_str_vector(&self) -> Vec<&str> {
match self {
ARCH::X32 => vec![ARCH_X86, "i386", "x32", "i686"],View on GitHub (pinned to aa36b38e69)
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.
Example fix
# before (env) export SE_OS=osx # after export SE_OS=macos
Defensive patterns
Strategy: validation
Validate before calling
// Rust: validate OS string before passing to str_to_os
fn is_supported_os(os: &str) -> bool {
let l = os.to_ascii_lowercase();
matches!(l.as_str(), "windows" | "win" | "macos" | "mac" | "linux" | "gnu/linux")
}
if !is_supported_os(&os_str) {
return Err(anyhow!("Use one of: windows, macos, linux"));
} Try / catch
let os = match str_to_os(&os_str) {
Ok(o) => o,
Err(e) if e.to_string().contains("Invalid operating system") => {
eprintln!("Set SE_OS to windows, macos, or linux");
return Err(e);
}
Err(e) => return Err(e),
}; Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Linux arm64 is not supported yet by Google Chrome. Please tr
- Linux arm64 is not supported yet by {}. Please try another b
- Linux arm64 is not supported yet by Microsoft Edge. Please t
- Linux arm64 is not supported yet by {}. Please try another b
- {} files are only supported in macOS
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/54f6be9512e23a24.
Report an issue: GitHub.