SeleniumHQ/selenium · error · anyhow::Error

Unsuccessful response ({}) for URL {}

Error message

Unsuccessful response ({}) for URL {}

What it means

Raised by download_to_tmp_folder() in rust/src/downloads.rs when an HTTP GET to the supplied URL completes but the response status is not 200 OK. Selenium Manager treats any non-OK status as a download failure, including 3xx (because reqwest follows redirects by default) and 4xx/5xx. The URL and status code are included for diagnosis.

Source

Thrown at rust/src/downloads.rs:45

use tempfile::{Builder, TempDir};

#[tokio::main]
pub async fn download_to_tmp_folder(
    http_client: &Client,
    url: String,
    log: &Logger,
) -> Result<(TempDir, String), Error> {
    let tmp_dir = Builder::new().prefix("selenium-manager").tempdir()?;
    log.trace(format!(
        "Downloading {} to temporal folder {:?}",
        url,
        tmp_dir.path()
    ));

    let response = http_client.get(&url).send().await?;
    let status_code = response.status();
    if status_code != StatusCode::OK {
        return Err(anyhow!(format!(
            "Unsuccessful response ({}) for URL {}",
            status_code, url
        )));
    }

    let target_path;
    let mut tmp_file = {
        let target_name = response
            .url()
            .path_segments()
            .and_then(|mut segments| segments.next_back())
            .and_then(|name| if name.is_empty() { None } else { Some(name) })
            .unwrap_or("tmp.bin");

        log.trace(format!("File to be downloaded: {}", target_name));
        let target_name = tmp_dir.path().join(target_name);
        target_path = String::from(target_name.to_str().unwrap());

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Check the URL in a browser/curl to see the exact status and confirm the resource exists.
  2. Retry after a short delay for transient 5xx errors.
  3. If using a mirror, verify the mirror URL env/config still resolves the driver.
  4. Pin a known-available driver version instead of the bleeding edge.
  5. Inspect proxy/VPN settings if you see 403/407.
Defensive patterns

Strategy: retry

Validate before calling

// Rust: pre-check reachability / status before delegating to download_to_tmp_folder
let resp = http_client.head(&url).send().await?;
if !resp.status().is_success() {
    return Err(anyhow!("Pre-check failed with {} for {}", resp.status(), url));
}

Try / catch

for attempt in 0..3 {
    match download_to_tmp_folder(&client, url.clone(), &log).await {
        Ok(result) => return Ok(result),
        Err(e) if e.to_string().contains("Unsuccessful response") && attempt < 2 => {
            tokio::time::sleep(std::time::Duration::from_secs(2u64.pow(attempt))).await;
            continue;
        }
        Err(e) => return Err(e),
    }
}

Prevention

When it happens

Trigger: http_client.get(&url).send().await returns a response with status_code != StatusCode::OK. Common: 404 for a yanked driver version, 403 from a rate-limited/region-blocked CDN, 5xx during an upstream outage, or a stale mirror.

Common situations: A driver version was unpublished (404); the mirror endpoint changed; transient Google/Microsoft CDN outage; corporate proxy returns 407/502; DNS resolves but TLS/CDN returns an error page.

Related errors


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