SeleniumHQ/selenium · error · anyhow::Error

Wrong version: {}

Error message

Wrong version: {}

What it means

Thrown by the private helper get_index_version() when the incoming version string is empty. This helper splits on '.' and returns the segment at the given index, so an empty input is rejected before splitting. The placeholder is the empty string.

Source

Thrown at rust/src/lib.rs:1996

        .replacen("{}", arg2, 1)
        .replacen("{}", arg3, 1)
}

pub fn format_four_args(string: &str, arg1: &str, arg2: &str, arg3: &str, arg4: &str) -> String {
    string
        .replacen("{}", arg1, 1)
        .replacen("{}", arg2, 1)
        .replacen("{}", arg3, 1)
        .replacen("{}", arg4, 1)
}

// ----------------------------------------------------------
// Private functions
// ----------------------------------------------------------

fn get_index_version(full_version: &str, index: usize) -> Result<String, Error> {
    if full_version.is_empty() {
        return Err(anyhow!(format!("Wrong version: {}", full_version)));
    }
    let version_vec: Vec<&str> = full_version.split('.').collect();
    Ok(version_vec
        .get(index)
        .ok_or(anyhow!(format!("Wrong version: {}", full_version)))?
        .to_string())
}

#[cfg(test)]
mod index_version_tests {
    use super::*;

    #[test]
    fn get_index_version_major() {
        assert_eq!(get_index_version("120.0.6099.109", 0).unwrap(), "120");
    }

    #[test]

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Trace the empty version in the Selenium Manager debug log to see which field was blank.
  2. Supply a concrete browser/driver version instead of leaving it empty.
  3. Ensure the browser is installed/detectable so a non-empty version is resolved.

Example fix

# before
selenium-manager --browser chrome --browser-version ""   # empty
# after
selenium-manager --browser chrome --browser-version 131
Defensive patterns

Strategy: validation

Validate before calling

fn require_nonempty_version(v: &str) -> Result<&str, Error> {
    if v.is_empty() { Err(anyhow!("version must not be empty")) } else { Ok(v) }
}
let major = get_index_version(require_nonempty_version(&version)?, 0)?;

Prevention

When it happens

Trigger: get_index_version(full_version, index) is called with full_version.is_empty() == true (lib.rs:1994-1996), e.g. get_major_version/major-browser-version logic receiving an empty string.

Common situations: An upstream browser/driver version resolved as empty and then fed into major-version extraction; a capability or config supplied an empty browserVersion.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/605f06c2234ddf90. Report an issue: GitHub.